Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/helpful_utils/activerecord_ext/humanized_attributes.rb

Class Method Summary collapse

Class Method Details

.human_attribute_name(attribute_key_name) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/helpful_utils/activerecord_ext/humanized_attributes.rb', line 2

def self.human_attribute_name(attribute_key_name)
  default = attribute_key_name.humanize
  if self.const_defined?('HUMANIZED_ATTRIBUTES')
    self.const_get('HUMANIZED_ATTRIBUTES')[attribute_key_name.to_sym] || default
  else
    default
  end
end