Class: ActiveRecord::Associations::Preloader::AlreadyLoaded

Inherits:
Object
  • Object
show all
Defined in:
activerecord/lib/active_record/associations/preloader.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, owners, reflection, preload_scope) ⇒ AlreadyLoaded

Returns a new instance of AlreadyLoaded.


171
172
173
174
# File 'activerecord/lib/active_record/associations/preloader.rb', line 171

def initialize(klass, owners, reflection, preload_scope)
  @owners = owners
  @reflection = reflection
end

Instance Attribute Details

#ownersObject (readonly)

Returns the value of attribute owners


169
170
171
# File 'activerecord/lib/active_record/associations/preloader.rb', line 169

def owners
  @owners
end

#reflectionObject (readonly)

Returns the value of attribute reflection


169
170
171
# File 'activerecord/lib/active_record/associations/preloader.rb', line 169

def reflection
  @reflection
end

Instance Method Details

#preloaded_recordsObject


178
179
180
# File 'activerecord/lib/active_record/associations/preloader.rb', line 178

def preloaded_records
  owners.flat_map { |owner| owner.association(reflection.name).target }
end

#run(preloader) ⇒ Object


176
# File 'activerecord/lib/active_record/associations/preloader.rb', line 176

def run(preloader); end