Question

I know that you can use the devise.en.yml locale to set custom error messages but message like "Password can't be blank" or "Email can't be blank" aren't in the locale to be customized. Is there anyway to change those?

After reading I found that I can use:

en:
  mongoid:
    errors:
      models:
        user:
          attributes:
            email:
              blank: "custom invalid message"

But now the message reads "Email custom invalid message". How come the name of the field is added to the beginning of the custom message? Is there anyway to change this behavior?

Was it helpful?

Solution

Try it:

en:
  mongoid:
    attributes:
      user:
        email: 'Your name for email'

'user' is the model and 'email' the field you want to translate.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top