The method you are talking about is ActiveRecord::Base#human
# Transform the model name into a more humane format, using I18n. By default,
# it will underscore then humanize the class name
#
# BlogPost.model_name.human # => "Blog post"
#
# Specify +options+ with additional translating options.
def human(options={})
return @human unless @klass.respond_to?(:lookup_ancestors) &&
@klass.respond_to?(:i18n_scope)
defaults = @klass.lookup_ancestors.map do |klass|
klass.model_name.underscore.to_sym
end
defaults << options.delete(:default) if options[:default]
defaults << @human
options.reverse_merge! :scope => [@klass.i18n_scope, :models], :count => 1, :default => defaults
I18n.translate(defaults.shift, options)
end
that internally relies on I18n.translate
. Thus options
can be any option supported by the I18n method, including :scope
, :default
and more.
See http://guides.rubyonrails.org/i18n.html#looking-up-translations
The options
argument also depends on the I18n backend you are currently using.