Rails Model Translation
Translation in Rails active records is used to provide integration between object and the Rails internationalization (i18n) framework. Rails does this using
ActiveModel::Translation.Example:
class Blog
extend ActiveModel::Translation
end
By using human_attribute_name, attribute names can be transformed into more human format. The human format is usually defined into your locale file as:
#File: config/locales/app.pt-BR.yml
pt-BR:
activemodel:
attributes:
blog:
title: 'Rails'
You can access this as:
Blog.human_attribute_name('title') # => "Rails"
0 Comment(s)