我有一个查询类,我希望它的human_readable名称在活动记录错误消息中是“搜索”。 activerecord本地化树如何寻找这种情况?在错误信息中本地化activerecord模型名称
我想:
en:
activerecord:
models:
query: "Search"
errors:
models:
query:
attributes:
name:
unique_within_scope: "blah blah"
和属性的东西通过作品:
errors.add(:name, I18n.t('activerecord.errors.models.query.attributes.name.unique_within_scope'))
模型。但我希望错误消息的翻译unique_within_scope会导致:
“搜索保存失败: 等等等等”
代替:
“查询保存失败: 等等等等”
就像现在这样。
任何帮助表示赞赏。谢谢!