Sha256: bcb68c23850d5b01179166440c4c8b9d5e7ac74f090000f732ef06e48a1a1388
Contents?: true
Size: 581 Bytes
Versions: 25
Compression:
Stored size: 581 Bytes
Contents
class ActiveRecord::Base # CarDealer.sales_count -> s_('CarDealer|Sales count') -> 'Sales count' if no translation was found def self.human_attribute_name(attribute, *args) s_(gettext_translation_for_attribute_name(attribute)) end # CarDealer -> _('car dealer') def self.human_name(*args) _(self.human_name_without_translation) end def self.human_name_without_translation self.to_s.underscore.gsub('_',' ') end private def self.gettext_translation_for_attribute_name(attribute) "#{self}|#{attribute.to_s.gsub('_',' ').capitalize}" end end
Version data entries
25 entries across 25 versions & 2 rubygems