module ActiveModel::Translation
Public Instance Methods
gettext_translation_for_attribute_name(attribute)
click to toggle source
# File lib/gettext_i18n_rails/active_model.rb, line 14 def gettext_translation_for_attribute_name(attribute) attribute = attribute.to_s if attribute.ends_with?('_id') humanize_class_name(attribute) else "#{self}|#{attribute.split('.').map! {|a| a.humanize }.join('|')}" end end
human_attribute_name(attribute, *args)
click to toggle source
CarDealer.sales_count -> s_(‘CarDealer|Sales count’) -> ‘Sales count’ if no translation was found
# File lib/gettext_i18n_rails/active_model.rb, line 10 def human_attribute_name(attribute, *args) s_(gettext_translation_for_attribute_name(attribute)) end
humanize_class_name(name=nil)
click to toggle source
# File lib/gettext_i18n_rails/active_model.rb, line 23 def humanize_class_name(name=nil) name ||= self.to_s name.underscore.humanize end