class method
self.human_name
Ruby on Rails 2.3.18
Since v2.2.3 Last seen in v2.3.18Available in: v2.2.3 v2.3.18
Signature
self.human_name(options = {})
Transform the modelname into a more humane format, using I18n. Defaults to the basic humanize method. Default scope of the translation is activerecord.models Specify options with additional translating options.
Parameters
-
optionsopt = {}
Source
# File activerecord/lib/active_record/base.rb, line 1410
def human_name(options = {})
defaults = self_and_descendants_from_active_record.map do |klass|
:"#{klass.name.underscore}"
end
defaults << self.name.humanize
I18n.translate(defaults.shift, {:scope => [:activerecord, :models], :count => 1, :default => defaults}.merge(options))
end
Defined in activerecord/lib/active_record/base.rb line 1410
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Base