1

I have the following validation:

validates :email, format: { with: Devise::email_regexp, message: I18n.t('activerecord.errors.models.client.attributes.email.invalid') }

The problem is, it is now showing the error message I specify there. It shows the default one.

What am I missing?

fedest
  • 1,190
  • 3
  • 15
  • 35

1 Answers1

0

i18n should not be included in the model, but rather in a YAML file.

en:
  activerecord:
    errors:
      models:
        my_model:
          attributes:
            whatever:
              inclusion: "Please select whatever." # see default key: "inclusion"

See more detailed answer about it here

Community
  • 1
  • 1
basgys
  • 4,320
  • 28
  • 39
  • Thank you, great answer. The chart on this link has all the information: http://guides.rubyonrails.org/i18n.html#translations-for-active-record-models – fedest May 31 '16 at 15:48