Flowdock

Notes posted by andmej

RSS feed
December 11, 2010 - (v3.0.0)
2 thanks

I18n file to change an attribute's name

If you are using Active Record, use a locale file like the one below to change a model’s attribute’s human name.

en:
  activerecord:
    attributes:
      picture:
        explanation: Description

Without using the locale file:

ruby-1.9.2-p0 > Picture.human_attribute_name("explanation")
 => "Explanation" 

Using the locale file:

ruby-1.9.2-p0 > Picture.human_attribute_name("explanation")
 => "Description"