zo_twg
Last Updated: February 25, 2016
·
570
· ordepdev

Humanized Attributes

Users aren't robots. So humanize model attributes first on your model .rb file :)

HUMANIZED_ATTRIBUTES = {
  :user_first_name => 'First Name',
  :user_last_name => 'Last Name'
}

def self.human_attribute_name(attr, options={})
  HUMANIZED_ATTRIBUTES[attr.to_sym] || super
end

1 Response
Add your response

4868

What is the point of this ? Could you explain ?

over 1 year ago ·