0

我正在构建一个 Rails 4 应用程序并希望改进模型验证中显示的错误消息我正在尝试更新语言环境en-GB.yml文件,如下所示:

activemodel:
  errors:
    <<: *errors
activerecord:
  errors:
    <<: *errors
  attributes:
    batch:
      sampletype_id: "Sample type"
      process_id: "Process Identifier"

批处理模型包含以下验证:

validates :sampletype_id, presence: true

batch模型和sampletype_id模型process_id属性在哪里。

这些没有被拾取并用于构建错误消息,例如。

Sampletype can't be blank而不是Sample type can't be blank

编辑:尝试遵循来自http://edgeguides.rubyonrails.org/i18n.html#translations-for-active-record-models的翻译

编辑2:yml 过去的bin http://pastebin.com/j1v9asww

4

1 回答 1

0

我通过更新 YML 文件顶部的配置行解决了这个问题。

谢谢穆罕默德!

于 2013-09-19T15:40:20.883 回答