Erol Fornoles wrote: > On Nov 29, 3:47?am, Scott Peterson <[EMAIL PROTECTED]> > wrote: >> >> the password attribute (string) would be passed into the hashed_password >> method, which would return a reference to a new string, which I would >> happen to assign to the hashed_password attribute. >> >> Can anyone shed a little light on what's under the covers? ?Just a >> curiousity question, it's all good after the rename. >> >> Attachments:http://www.ruby-forum.com/attachment/2981/player.rb >> >> -- >> Posted viahttp://www.ruby-forum.com/. > > I'm guessing that you may have overwritten the default AR accessor for > 'password' with your call to: > > attr_accessor :password > > Hence, the 'password' field not being saved to the db. > > A better approach, IMHO, is naming your password field differently > (like password_hash) and saving it with a the below password method: > > def password=(password) > self.password_hash = Digest::SHA1.hexdigest(password) > end > > That way, you can set a new password for the given player even after > it has already been created.
Yep, absolutely right--exactly what I did is re-name the db column as you show, and off I went. I was thinking of them like members of a java class, I'll have to read up on the attr_accessor and how these objects actually act. Thank you for the response. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

