我有一個查詢類,我希望它的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會導致:
「搜索保存失敗: 等等等等」
代替:
「查詢保存失敗: 等等等等」
就像現在這樣。
任何幫助表示讚賞。謝謝!