Class: ActiveRecord::Associations::Preloader::Association
- Defined in:
- activerecord/lib/active_record/associations/preloader/association.rb
Overview
:nodoc:
Direct Known Subclasses
Instance Attribute Summary collapse
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#owners ⇒ Object
readonly
Returns the value of attribute owners.
-
#preload_scope ⇒ Object
readonly
Returns the value of attribute preload_scope.
-
#preloaded_records ⇒ Object
readonly
Returns the value of attribute preloaded_records.
-
#reflection ⇒ Object
readonly
Returns the value of attribute reflection.
Instance Method Summary collapse
-
#association_key_name ⇒ Object
The name of the key on the associated records.
-
#initialize(klass, owners, reflection, preload_scope) ⇒ Association
constructor
A new instance of Association.
-
#owner_key_name ⇒ Object
The name of the key on the model which declares the association.
- #preload(preloader) ⇒ Object
- #run(preloader) ⇒ Object
Constructor Details
#initialize(klass, owners, reflection, preload_scope) ⇒ Association
Returns a new instance of Association.
10 11 12 13 14 15 16 17 |
# File 'activerecord/lib/active_record/associations/preloader/association.rb', line 10 def initialize(klass, owners, reflection, preload_scope) @klass = klass @owners = owners @reflection = reflection @preload_scope = preload_scope @model = owners.first && owners.first.class @preloaded_records = [] end |
Instance Attribute Details
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
7 8 9 |
# File 'activerecord/lib/active_record/associations/preloader/association.rb', line 7 def klass @klass end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
7 8 9 |
# File 'activerecord/lib/active_record/associations/preloader/association.rb', line 7 def model @model end |
#owners ⇒ Object (readonly)
Returns the value of attribute owners.
7 8 9 |
# File 'activerecord/lib/active_record/associations/preloader/association.rb', line 7 def owners @owners end |
#preload_scope ⇒ Object (readonly)
Returns the value of attribute preload_scope.
7 8 9 |
# File 'activerecord/lib/active_record/associations/preloader/association.rb', line 7 def preload_scope @preload_scope end |
#preloaded_records ⇒ Object (readonly)
Returns the value of attribute preloaded_records.
8 9 10 |
# File 'activerecord/lib/active_record/associations/preloader/association.rb', line 8 def preloaded_records @preloaded_records end |
#reflection ⇒ Object (readonly)
Returns the value of attribute reflection.
7 8 9 |
# File 'activerecord/lib/active_record/associations/preloader/association.rb', line 7 def reflection @reflection end |
Instance Method Details
#association_key_name ⇒ Object
The name of the key on the associated records
28 29 30 |
# File 'activerecord/lib/active_record/associations/preloader/association.rb', line 28 def association_key_name raise NotImplementedError end |
#owner_key_name ⇒ Object
The name of the key on the model which declares the association
33 34 35 |
# File 'activerecord/lib/active_record/associations/preloader/association.rb', line 33 def owner_key_name raise NotImplementedError end |
#preload(preloader) ⇒ Object
23 24 25 |
# File 'activerecord/lib/active_record/associations/preloader/association.rb', line 23 def preload(preloader) raise NotImplementedError end |
#run(preloader) ⇒ Object
19 20 21 |
# File 'activerecord/lib/active_record/associations/preloader/association.rb', line 19 def run(preloader) preload(preloader) end |