Reputation: 2548
Following a series of videos, I'm trying to get has_secure_password
working in a rails project. And it does work. It hashes passwords, it performs authentication.
I just can't get it to validate when I set a password for a new user.
As I understand the process, has_secure_password
is supposed to add a validation rule which ensures the password has been set and then a second validation rule which requires the password be confirmed. Neither of these things is happening. I can save users with no password and I can save users without confirmation field and I can save users where :password
does not match :password_confirmation
Is there something blindingly obvious that I'm missing? Should I make validation rules for :password
?
I'm not going to bother posting any code because I'm not sure what would be relevant. But if there's something you'd like to see, I'd be happy to post it.
Thanks!
Upvotes: 0
Views: 86
Reputation: 2548
Nevermind. I forgot to add :password_confirmation
to the params.require
I think it's working now.
Kind of strange that has_secure_password
just goes ahead and works even though :password_confirmation
was disallowed.
Upvotes: 3