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?

有帮助吗?

解决方案

Try it:

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

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top