0

我正在将 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 环境选择上述设置?

非常感谢

4

2 回答 2

1

Here's the solution:

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"

This gist outlines how to craft custom errors as well: https://gist.github.com/lurkermike/1596505

于 2015-03-20T20:02:41.620 回答
-1

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

于 2014-01-30T19:04:51.480 回答