문제

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