Class: Superstore::Associations::AssociationScope

Inherits:
ActiveRecord::Relation
  • Object
show all
Defined in:
lib/superstore/associations/association_scope.rb

Instance Method Summary collapse

Constructor Details

#initialize(klass, association) ⇒ AssociationScope

Returns a new instance of AssociationScope.



4
5
6
7
# File 'lib/superstore/associations/association_scope.rb', line 4

def initialize(klass, association)
  super(klass)
  @association = association
end

Instance Method Details

#<<(*records) ⇒ Object



13
14
15
16
17
# File 'lib/superstore/associations/association_scope.rb', line 13

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

#exec_queriesObject



9
10
11
# File 'lib/superstore/associations/association_scope.rb', line 9

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