I have got a form with a bunch of fields and model validations.
How can I return all possible validation errors that can be raised?
I need it to write locales for all of them.
I want to get a list like this:
password blank
password too_short
password confirmation
login blank
login invalid
email blank
email too_short
email invalid
etc
Basically what Pablo says, except that the page on the rails docs doesn’t show how to override the messages for a particular model and field. here’s an example from one of my apps:
I’ve also changed the basic format for error messages, as sometimes i didn’t want the field name shoved at the start of the message. So, i changed
to
Which is why i then specify
{{attribute}}in my subsequent errors, to put it back in in most but not all cases.Note also that i’m using the old syntax of
{{var}}rather than%{var}. The same principles apply though.