Commit 4b766236
Changed files (4)
app
models
spec
models
app/models/user.rb
@@ -38,14 +38,6 @@ class User < ActiveRecord::Base
self.save
end
- def password_digest
- encrypted_password
- end
-
- def password_digest=(value)
- self.encrypted_password = value
- end
-
def has_avatar?
self.avatar && self.avatar.image.present?
end
db/migrate/20141016000307_rename_password_column.rb
@@ -0,0 +1,6 @@
+class RenamePasswordColumn < ActiveRecord::Migration
+ def change
+ rename_column :users, :encrypted_password, :password_digest
+ remove_column :users, :password_salt, :string
+ end
+end
db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20141001025113) do
+ActiveRecord::Schema.define(version: 20141016000307) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -191,7 +191,7 @@ ActiveRecord::Schema.define(version: 20141001025113) do
create_table "users", force: true do |t|
t.string "email", default: "", null: false
- t.string "encrypted_password", default: "", null: false
+ t.string "password_digest", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "created_at"
@@ -201,7 +201,6 @@ ActiveRecord::Schema.define(version: 20141001025113) do
t.string "twitter"
t.string "facebook"
t.string "city"
- t.string "password_salt"
t.string "authentication_token"
t.string "full_address"
t.integer "creations_count", default: 0
spec/models/password_reset_spec.rb
@@ -35,7 +35,7 @@ describe PasswordReset do
it "changes the users password" do
PasswordReset.reset(reset_token, password)
user.reload
- expect(user.valid_password?(password)).to be_truthy
+ expect(user.authenticate(password)).to be_truthy
end
it "deletes the reset token" do