Class: ActiveRecord::Associations::Preloader::Association::LoaderRecords

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

Instance Method Summary collapse

Constructor Details

#initialize(loaders, loader_query) ⇒ LoaderRecords

Returns a new instance of LoaderRecords.



58
59
60
61
62
63
64
65
# File 'lib/active_record/associations/preloader/association.rb', line 58

def initialize(loaders, loader_query)
  @loader_query = loader_query
  @loaders = loaders
  @keys_to_load = Set.new
  @already_loaded_records_by_key = {}

  populate_keys_to_load_and_already_loaded_records
end

Instance Method Details

#recordsObject



67
68
69
# File 'lib/active_record/associations/preloader/association.rb', line 67

def records
  load_records + already_loaded_records
end