method
call
v7.0.0 -
Show latest stable
-
0 notes -
Class: Batch
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0
- 3.0.9
- 3.1.0
- 3.2.1
- 3.2.8
- 3.2.13
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1
- 5.1.7
- 5.2.3
- 6.0.0
- 6.1.3.1
- 6.1.7.7
- 7.0.0 (0)
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- What's this?
call()
public
Hide source
# File activerecord/lib/active_record/associations/preloader/batch.rb, line 12 def call branches = @preloaders.flat_map(&:branches) until branches.empty? loaders = branches.flat_map(&:runnable_loaders) loaders.each { |loader| loader.associate_records_from_unscoped(@available_records[loader.klass.base_class]) } if loaders.any? future_tables = branches.flat_map do |branch| branch.future_classes - branch.runnable_loaders.map(&:klass) end.map(&:table_name).uniq target_loaders = loaders.reject { |l| future_tables.include?(l.table_name) } target_loaders = loaders if target_loaders.empty? group_and_load_similar(target_loaders) target_loaders.each(&:run) end finished, in_progress = branches.partition(&:done?) branches = in_progress + finished.flat_map(&:children) end end