Class: ActiveRecord::Associations::Preloader::AlreadyLoaded
- Inherits:
-
Object
- Object
- ActiveRecord::Associations::Preloader::AlreadyLoaded
- Defined in:
- lib/active_record/associations/preloader.rb
Instance Attribute Summary collapse
-
#owners ⇒ Object
readonly
Returns the value of attribute owners.
-
#reflection ⇒ Object
readonly
Returns the value of attribute reflection.
Instance Method Summary collapse
-
#initialize(klass, owners, reflection, preload_scope) ⇒ AlreadyLoaded
constructor
A new instance of AlreadyLoaded.
- #preloaded_records ⇒ Object
- #run(preloader) ⇒ Object
Constructor Details
#initialize(klass, owners, reflection, preload_scope) ⇒ AlreadyLoaded
Returns a new instance of AlreadyLoaded.
178 179 180 181 |
# File 'lib/active_record/associations/preloader.rb', line 178 def initialize(klass, owners, reflection, preload_scope) @owners = owners @reflection = reflection end |
Instance Attribute Details
#owners ⇒ Object (readonly)
Returns the value of attribute owners.
176 177 178 |
# File 'lib/active_record/associations/preloader.rb', line 176 def owners @owners end |
#reflection ⇒ Object (readonly)
Returns the value of attribute reflection.
176 177 178 |
# File 'lib/active_record/associations/preloader.rb', line 176 def reflection @reflection end |
Instance Method Details
#preloaded_records ⇒ Object
185 186 187 |
# File 'lib/active_record/associations/preloader.rb', line 185 def preloaded_records owners.flat_map { |owner| owner.association(reflection.name).target } end |
#run(preloader) ⇒ Object
183 |
# File 'lib/active_record/associations/preloader.rb', line 183 def run(preloader); end |