made a suggestion based on digininjas comment on Rails tutorials blog post. Better to change method name to hash_password than encrypt_password

This commit is contained in:
cktricky
2013-08-08 16:57:58 -04:00
parent c024bd6591
commit 65eb2caeaf
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -11,7 +11,7 @@ class User < ActiveRecord::Base
validates_format_of :email, :with => /.+@.+\..+/i
attr_accessor :skip_user_id_assign
before_save :assign_user_id, :on => :create
before_save :encrypt_password
before_save :hash_password
has_one :retirement, :foreign_key => :user_id, :primary_key => :user_id, :dependent => :destroy
has_one :paid_time_off, :foreign_key => :user_id, :primary_key => :user_id, :dependent => :destroy
has_one :work_info, :foreign_key => :user_id, :primary_key => :user_id, :dependent => :destroy
@@ -45,7 +45,7 @@ class User < ActiveRecord::Base
end
end
def encrypt_password
def hash_password
if self.password.present?
self.password = Digest::MD5.hexdigest(password)
end