1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

the preloader for the RHS has all the preloaded records, so ask it

This commit is contained in:
Aaron Patterson 2013-10-14 13:23:03 -07:00
parent 19b871a090
commit 43a63f6d5e

View file

@ -29,6 +29,8 @@ module ActiveRecord
source_reflection.name,
reflection_scope)
@preloaded_records.concat preloaders.flat_map(&:preloaded_records)
middle_to_pl = preloaders.each_with_object({}) do |pl,h|
pl.owners.each { |middle|
h[middle] = pl
@ -53,9 +55,7 @@ module ActiveRecord
}.compact
record_index = pl_indexes[pl]
records = rhs_records.sort_by { |rhs| record_index[rhs] }
@preloaded_records.concat rhs_records
records
rhs_records.sort_by { |rhs| record_index[rhs] }
end
}
end