Sha256: 2f8a2501f214ea9f841a863c5018ac9aa3b6ea0d59f9ef5292f3584a2ad476a6

Contents?: true

Size: 578 Bytes

Versions: 9

Compression:

Stored size: 578 Bytes

Contents

require 'active_data/model/attributes/reflections/localized'
require 'active_data/model/attributes/localized'

module ActiveData
  module Model
    module Localization
      extend ActiveSupport::Concern

      module ClassMethods
        def localized(*args, &block)
          add_attribute(ActiveData::Model::Attributes::Reflections::Localized, *args, &block)
        end

        def fallbacks(locale)
          ::I18n.respond_to?(:fallbacks) ? ::I18n.fallbacks[locale] : [locale]
        end

        def locale
          I18n.locale
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
active_data-1.2.0 lib/active_data/model/localization.rb
active_data-1.1.7 lib/active_data/model/localization.rb
active_data-1.1.6 lib/active_data/model/localization.rb
active_data-1.1.5 lib/active_data/model/localization.rb
active_data-1.1.4 lib/active_data/model/localization.rb
active_data-1.1.3 lib/active_data/model/localization.rb
active_data-1.1.2 lib/active_data/model/localization.rb
active_data-1.1.1 lib/active_data/model/localization.rb
active_data-1.1.0 lib/active_data/model/localization.rb