我对 mongoid 和模型翻译有疑问。当我尝试在我的模型上使用 mongoDB 时,我不知道要翻译属性和模型名称。它通常在 *.yml 文件中,但此时这不起作用。有什么想法吗?
最佳答案
带有“activemodel”的变体对我不起作用。但是。
这个变种对我有用:
en:
mongoid:
errors:
models:
user:
attributes:
email:
blank: "You have to give me your e-mail address"
not_found: "e-mail address not found in list of members"
#...
attributes:
user:
email: "Email address"
name: "Your nickname"
#...
关于ruby-on-rails - 用mongoid翻译rails中的模型属性的方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3465481/