I have a form with 3 fields: user_id, email and password.
All 3 fields are required, so I have a “validates_presence_of :user_id,
:email, :password” in my model.
Works, but the validation errors show up in a different order than I
specificed in the validates_presence_of statement.
Is there a way to specify the order in which the validations (and
corresponding error messages) should occur using the built in validation
methods like validates_presence_of?
Thanks for the assistance,
Jeff
Is there a way to specify the order in which the validations (and
corresponding error messages) should occur using the built in validation
methods like validates_presence_of?
Have you tried:
validates_presence_of :user_id
validates_presence_of :email
validates_presence_of :password
Lindsay
Lindsay B. wrote:
Have you tried:
validates_presence_of :user_id
validates_presence_of :email
validates_presence_of :password
Lindsay
Yes, same results: email can’t be blank, followed by user id then
password
Jeff
I think the validation targets are stored in a hash, in which order is
never guaranteed.
Seems like someone was annoyed with this a while back and created a
plugin to control
order of validation… EZ was that you? Hmm, actually I think it was
another
over-achiever… Well, you might search the wiki and/or google for it.
b