質問

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