E
E
eldar_web2015-05-06 18:14:29
Ruby on Rails
eldar_web, 2015-05-06 18:14:29

Why (in Rails 4.2) does the password: confirmation validation not work???

There is a validation like this:

validates :password, presence: true
  	validates :password, confirmation: true
  	validates :password_confirmation, presence: true

The password_confirmation field itself does not exist, but the documentation says that if you write validates :password, confirmation: true, it will create a virtual password_confirmation attribute. And in the form I created such a field, and I fill in the official field and the password_confirmation field, but after clicking on the button it says that the last field is not filled.
I looked in the controller, and the content from password_confirmation is there, and after assigning it to @user, @user.password_confirmation is empty.
How to solve the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Risent Veber, 2015-08-28
@risentveber

It's easy enough to write:

validates :password, presence: true, confirmation: true

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question