Module: Gaigo::Naming::HumanModelName
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/gaigo/models/naming/human_model_name.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#try_human(options = {}, &block) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/gaigo/models/naming/human_model_name.rb', line 12 def try_human(={}, &block) = { :count => 1 }.merge!() return @human unless @klass.respond_to?(:lookup_ancestors) && @klass.respond_to?(:i18n_scope) defaults = @klass.lookup_ancestors.map do |klass| :"#{klass.i18n_scope}.models.#{klass.model_name.i18n_key}" ## changed end if block_given? # yield defaults # end # defaults << .delete(:default) if [:default] [:default] = defaults I18n.try_translate(defaults.shift, ) do [:default] << @human end end |