Domanda

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?

È stato utile?

Soluzione

Try it:

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

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top