I’ve implemented Rails Recipe #31, Authentication, and I found that
validating password and password_confirmation just doesnâ??t work while
the method â??password=(pass)â?? is in the mix, but I need that for the
If I donâ??t use validations, the password gets hashed, salted and stored
in the database fine. I can login with same username/password.
However, if I want to validate user input (who wouldnâ??t?) I get told
that ‘password canâ??t be blank, password doesnâ??t match
password_confirmation,’ even though in the dump, it clearly shows both
password and password_confirmation as having the same word. I thought
it may have something to do with the fact that both password &
password_confirmation don’t actually exist in the database or that I’m
using edge rails, but If I remove the method â??password=(pass)â??, then the
validations work perfectly, telling me only when the fields are indeed
blank or don’t match, but then of course I get no password_salt or
password_hash stored in the database!! Anyone have a different way to
generate salt/password_hash other than the ‘password=(pass)’ method?
I installed acts_as_authenticated as well, and that uses a :if =>
:password_required? call after each password validation line… a method
that seems to simply ignore validating the password fields all together.
(could be wrong on that)
â??attr_accessor :passwordâ?? to my user.rb file
â??validates_presence_of :password, password_confirmationâ??
How can I get salt/hash AND validate input for password /