![]() | Help in understanding encrypting the password |
|
05 Jun 2009, 18:43
Dhana Shunmugasundram (1 post) |
I am currently on page 183 on the pdf version and I am a little confused about this method. Looks like this is an instance method and not a class method, but why is the salt and encrypted_password need the self keyword in front of it. Would really appreciate it if someone could give me an idea what’s actually happening.
def encrypt_password
return if password.blank?
if new_record?
self.salt = Digest::SHA1.hexdigest("--#{Time.now}--#{email}--" )
end
self.encrypted_password = User.encrypt(password, salt)
end
|
|
06 Jun 2009, 02:40
Derek DeVries (18 posts) |
Dhana, The The difference is that in the case of The Here is an article that explains Hope this helps! |
| You must be logged in to comment |

