Sha256: 3607421f4e08b89ac34f7e21e066a679d8ef961afc29fe00155d6b5efe2ffeba

Contents?: true

Size: 359 Bytes

Versions: 2

Compression:

Stored size: 359 Bytes

Contents

module ActiveRecord
  module ClassMethods
    # TODO: This should really be in hyper-mesh
    def model_name
      @model_name ||= ActiveModel::Name.new(self)
    end

    def human_attribute_name(attribute, opts = {})
      attribute = "activerecord.attributes.#{model_name.i18n_key}.#{attribute}"

      HyperI18n::I18n.t(attribute, opts)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hyper-i18n-0.99.0 lib/hyper-i18n/active_record/class_methods.rb
hyper-i18n-0.1.1 lib/hyper-i18n/active_record/class_methods.rb