Class: Superstore::Associations::AssociationScope
- Inherits:
-
ActiveRecord::Relation
- Object
- ActiveRecord::Relation
- Superstore::Associations::AssociationScope
- Defined in:
- lib/superstore/associations/association_scope.rb
Instance Method Summary collapse
- #<<(*records) ⇒ Object
- #exec_queries ⇒ Object
-
#initialize(klass, association) ⇒ AssociationScope
constructor
A new instance of AssociationScope.
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_queries ⇒ Object
9 10 11 |
# File 'lib/superstore/associations/association_scope.rb', line 9 def exec_queries super.each { |r| @association.set_inverse_instance r } end |