Rails 3: Modify error message prefix for form validation -


Nested forms are very good, but I've found that sometimes there might be an error message that is oddly formatted Are there.

To give a solid example: I have a form that creates a new account in each account for one or more users Uses the (strong-medium) registration form form uses the Account model and includes several fields to create first users (as the account contains at least Should be a user) In other words, this is a nested form

Since there may be many users in an account, the error message prefix is ​​called "user" instead of "user." Also, the error message is the relationship name (user) and attribute name (for example, "Password") to create an error message. Instead of "Email can not be empty" "User email can not be empty." . . This results in the error message as a result

Is there a way to customize the error message or leave the "user" with the error message?

: Message parameters of your verification, you can add a carpet that will snatch the default message.

 : message = & gt; "^ Email can not be empty"    

Comments