Sha256: d45f9b83ed7ed4b3605c0ab2bbc2085ad4a9252424125a21066dd9097ac5ecdb

Contents?: true

Size: 419 Bytes

Versions: 2

Compression:

Stored size: 419 Bytes

Contents

module Superstore
  module Associations
    class AssociationScope < ActiveRecord::Relation
      def initialize(klass, association)
        super(klass)
        @association = association
      end

      def exec_queries
        super.each { |r| @association.set_inverse_instance r }
      end

      def <<(*records)
        if loaded?
          @records = @records + records
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
superstore-3.0.0 lib/superstore/associations/association_scope.rb
superstore-2.5.0 lib/superstore/associations/association_scope.rb