Last Updated: February 25, 2016
·
1.047K
· 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

What is the point of this ? Could you explain ?

over 1 year ago ·