rails 4 mongoid locales en.yml无效

时间:2013-10-09 13:52:41

标签: ruby-on-rails mongodb

我正在将rails应用程序转换为从sqlite运行到mongodb。到目前为止一直很好,但它没有拿起我的config / locales / en.yml设置: -

en:
  activerecord:
      models:
          access_ref: "Access Type"
          applicant_type_ref: "Applicant Type"
          applicant_custom_ref: "Applicant Custom Field"
          limit_ref: "Spending Limit Increment"
          tenure_ref: "Tenure Type"
          property_type_ref: "Property Type"
          property_custom_ref: "Property Custom Field"

我需要做些什么更改才能让rails 4 / mongoid环境选择上述设置?

非常感谢

2 个答案:

答案 0 :(得分:1)

以下是解决方案:

en:
  mongoid:
    attributes:
      model_name_here:
        access_ref: "Access Type"
        applicant_type_ref: "Applicant Type"
        applicant_custom_ref: "Applicant Custom Field"
        limit_ref: "Spending Limit Increment"
        tenure_ref: "Tenure Type"
        property_type_ref: "Property Type"
        property_custom_ref: "Property Custom Field"

这个要点概述了如何制作自定义错误:https://gist.github.com/lurkermike/1596505

答案 1 :(得分:-1)

尝试更改此活动记录:使用mongoid: