Sha256: 445c0ce9edbfce2f25be7550371f367939a2b825a88646effda3ca75954a0413

Contents?: true

Size: 402 Bytes

Versions: 25

Compression:

Stored size: 402 Bytes

Contents

module Dorsale
  module ModelI18n
    def t(*args)
      self.class.human_attribute_name(*args)
    end

    def self.included(model)
      model.instance_eval do
        def t(*args)
          if args.any?
            human_attribute_name(*args)
          else
            model_name.human
          end
        end
      end
    end
  end
end

ActiveRecord::Base.send(:include, ::Dorsale::ModelI18n)

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
dorsale-2.2.8 lib/dorsale/model_i18n.rb
dorsale-2.2.6 lib/dorsale/model_i18n.rb
dorsale-2.2.5 lib/dorsale/model_i18n.rb
dorsale-2.2.4 lib/dorsale/model_i18n.rb
dorsale-2.2.3 lib/dorsale/model_i18n.rb
dorsale-2.2.2 lib/dorsale/model_i18n.rb
dorsale-2.2.1 lib/dorsale/model_i18n.rb
dorsale-2.2.0 lib/dorsale/model_i18n.rb
dorsale-2.1.15 lib/dorsale/model_i18n.rb
dorsale-2.1.14 lib/dorsale/model_i18n.rb
dorsale-2.1.13 lib/dorsale/model_i18n.rb
dorsale-2.1.12 lib/dorsale/model_i18n.rb
dorsale-2.1.11 lib/dorsale/model_i18n.rb
dorsale-2.1.10 lib/dorsale/model_i18n.rb
dorsale-2.1.9 lib/dorsale/model_i18n.rb
dorsale-2.1.8 lib/dorsale/model_i18n.rb
dorsale-2.1.7 lib/dorsale/model_i18n.rb
dorsale-2.1.6 lib/dorsale/model_i18n.rb
dorsale-2.1.5 lib/dorsale/model_i18n.rb
dorsale-2.1.4 lib/dorsale/model_i18n.rb