Ruby on Rails
Tuesday, July 31, 2012
On Monday, July 30, 2012 6:40:51 PM UTC-4, pavling wrote:
On 30 July 2012 22:39, jsnark wrote:
> I understand the problem now, but I do not see the solution. The model has
> a before_save filter that is causing the password to be reset. How do I
> stop this on an update?
The same way I said before - only run it if the password has been populated:
def encrypt_password
self.encrypted_password = encrypt(self.password) unless
self.password.blank?
end
But you will probably need to add same validation to ensure there is
an encrypted_password - otherwise it would be possible to create
accounts with blank passwords...
Thank you.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/RIfvsT32vIsJ.
For more options, visit https://groups.google.com/groups/opt_out.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment