Sha256: 94686b9d2f2d3633036fadaad3eb42c96f598e7e67a23d8f16a59d976aad86cb

Contents?: true

Size: 603 Bytes

Versions: 4

Compression:

Stored size: 603 Bytes

Contents

module ActiveModel::Associations
  module AssociationScopeExtension
    if ActiveRecord.version.to_s < "4.1"
      def add_constraints(scope)
        if reflection.options[:active_model]
          target_ids = reflection.options[:target_ids]
          return scope.where(id: owner[target_ids])
        end

        super
      end
    else
      def add_constraints(scope, owner, assoc_klass, refl, tracker)
        if refl.options[:active_model]
          target_ids = refl.options[:target_ids]
          return scope.where(id: owner[target_ids])
        end

        super
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
activemodel-associations-0.1.0 lib/active_model/associations/association_scope_extension.rb
activemodel-associations-0.0.3 lib/active_model/associations/association_scope_extension.rb
activemodel-associations-0.0.2 lib/active_model/associations/association_scope_extension.rb
activemodel-associations-0.0.1 lib/active_model/associations/association_scope_extension.rb