Sha256: aece1ddddba559264627eb1beedad48640d8a6bfb3e76e4b0b511be182cb7907

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

module Mobility
=begin

Module loading ActiveRecord-specific classes for Mobility models.

=end
  module ActiveRecord
    autoload :AttributeMethods,    "mobility/active_record/attribute_methods"
    autoload :BackendResetter,     "mobility/active_record/backend_resetter"
    autoload :ModelTranslation,    "mobility/active_record/model_translation"
    autoload :StringTranslation,   "mobility/active_record/string_translation"
    autoload :TextTranslation,     "mobility/active_record/text_translation"
    autoload :Translation,         "mobility/active_record/translation"
    autoload :UniquenessValidator, "mobility/active_record/uniqueness_validator"

    def self.included(model_class)
      model_class.extend(ClassMethods)
      model_class.const_set(:UniquenessValidator,
                            Class.new(::Mobility::ActiveRecord::UniquenessValidator))
    end

    module ClassMethods
      # @return [ActiveRecord::Relation] relation extended with Mobility query methods.
      define_method ::Mobility.query_method do
        all
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mobility-0.1.20 lib/mobility/active_record.rb
mobility-0.1.19 lib/mobility/active_record.rb
mobility-0.1.18 lib/mobility/active_record.rb