Hi,
I am not sure if this is already answered in this list. I couldn’t
find an answer. So I am posting the question.
I have multiple validations for a field. For example:
validates_presence_of :contact_email
validates_format_of :contact_email,
:with =>
/^([^@\s]+)@((?:[-a-z0-9]+.)+[a-z]{2,})$/i,
:message => “is not a valid email address”
When I submit the form with a blank contact_email I get 2 error
messages:
Contact email is not a valid email address
Contact email can’t be blank
If the field is blank the second validations obviously fails.
I think Rails should look for blankness of the field and then just
show one error message saying it’s a blank field.
Any solutions or workarouns?
Thanks much.