devise validatable and password_confirmation presence

Hi,

I was writing some tests when I discovered (god bless testing…) that my User model, that use Devise, doesn’t validate the presence of the :password_confirmation field.

I was expecting that adding :validatable to the Devise option would include the presence validation for this field too.

Could any one please explain this behaviour?

There is a better solution than simply adding that field to User model validation?

thank you.

bye,

enricostn

Can't follow you… all the confirmation-fields you probably have, don't
need to be checked if they are present… That's throwing away CPU
cycles and therefore money!

It is simple logic:

When all validations pass on the original field they will also pass on
the corresponding confirmation field, as long as it has the same value
as the original field. So do all necessary validations on your
original field, check if it is identical with the confirmation field
and you are done…

Ok I got it. You're probably right. The validation for the
confirmation field it's related to the comparation with the original
field.

Thanks