Module: ActiveModel::Translation
- Defined in:
- lib/humpyard/active_model/translation.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#human_attribute_name_with_namespaces(attribute, options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/humpyard/active_model/translation.rb', line 5 def human_attribute_name_with_namespaces(attribute, = {}) # Namespace patch defaults = [] lookup_ancestors.each do |klass| name = klass.model_name.underscore.split('/') while name.size > 0 defaults << :"#{self.i18n_scope}.attributes.#{name * '.'}.#{attribute}" name.pop end end # Rails orig defaults << :"attributes.#{attribute}" defaults << .delete(:default) if [:default] defaults << attribute.to_s.humanize .reverse_merge! :count => 1, :default => defaults I18n.translate(defaults.shift, ) end |