Don't store the plain text and the hashed password in the same
column.  Create the methods for the plain text password in your model
and store the hashed (and salted and stretched I hope) value in the
database.  Then fix your validation, since the model should be
checking the password before hashing, not as part of the validation.

On May 1, 4:30 am, Gavin <[email protected]> wrote:
> I have class User, user has a password
>
> Password should only be valid if it's between 6 and 16 chars in
> length.
>
> New user is created if everything is valid and it's stored to the db.
>
> After saving to the database, the password is then hashed making it
> over 16 chars in length.
>
> The User record no longer passes validation.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to