Rails I18n - 模型验证返回[object Object]

时间:2012-09-18 18:02:03

标签: ruby-on-rails ruby validation model internationalization

验证规则示例:

  validates :first_name, :presence => {:message => I18n.t('activerecord.errors.models.user.required_item')}, :allow_blank => true, :length => {:minimum => 3, :maximum => 40}

区域设置:

de:
  activerecord:
      errors:
        models:
          user:
            povinne_pole:
              required_item: "error message" # see default key: "inclusion"

返回

[object Object]

我做错了什么?

1 个答案:

答案 0 :(得分:1)

你在I18n.t电话中错过了povinne_pole