In my User.rb model, I have this line:
validates_confirmation_of :password, :message => "Your passwords should match."
Then when the user signs up, the passwords match, everything is great... until I want to add more information to the user object, then save again. But running @user.save returns the error that my passwords don't match. In my signup controller method, I have these lines:
@user = User.new(params[:user])
if request.post?
if [email protected]
@errors = @user.errors
else
# crucial user details:
@user.salt = [Array.new(6){rand(256).chr}.join].pack("m").chomp
@user.password = encrypted_password(@user.password, @user.salt) #hash this
if [email protected]
puts "error for some reason in signup"
puts @user.errors.inspect
end
And upon inspection, @users.errors.inspect prints out: #["Your passwords should match."]}. They did, otherwise, it would never have passed the first .save call. Any advice on what I'm doing wrong here?
Thanks for your help.