Reputation: 16015
How to use a fallback for very often used attr_names
like title
and created_at
?
How it usually works:
activerecord.attributes.[model_name].attr_name
I want todo something like that:
activerecord.attributes.defaults.attr_name
There are so many examples of how to do it for the error massages, but none for the plain attributes :( http://guides.rubyonrails.org/v2.3.8/i18n.html#translations-for-active-record-models
Upvotes: 4
Views: 1303
Reputation: 3846
Here's the file containing the method which handles the translations (human_attribute_name). I think seeing this you can just do in your lang.yml
for instance :
attributes:
username: "Nickname"
instead of :
attributes:
user:
username: "Nickname"
And it should work for all models !
Upvotes: 7