自定义属性的错误消息格式

时间:2014-12-12 00:40:08

标签: ruby-on-rails locale

每当我提交一封已收到电子邮件的表单时,我都会收到以下错误:

Avatar email email Email has already been taken.

在我的语言环境中我有

en:
  hello: "Hello world"
  activerecord:
    errors:
      models:
        avatar_email:
          attributes:
            email:
              format: '%{message}'
              taken: 'Email has already been taken'

我认为format属性会修复它,但它仍然呈现属性和消息。如何修复要设置的语言环境文件,以便返回的消息为Email has already been taken

0 个答案:

没有答案