Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

lhs preload is always a single preload, so just preload one

  • Loading branch information...
commit 931a6aba363e9ef70c8dec368d332a279e6bbfd9 1 parent a04965b
@tenderlove tenderlove authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 activerecord/lib/active_record/associations/preloader.rb
View
6 activerecord/lib/active_record/associations/preloader.rb
@@ -112,10 +112,10 @@ def preload(association)
end
def preload_hash(association)
- association.each do |parent, child|
- Preloader.new(records, parent, preload_scope).run
+ association.flat_map { |parent, child|
+ preload_one parent
Preloader.new(records.map { |record| record.send(parent) }.flatten, child).run
- end
+ }
end
# Not all records have the same class, so group then preload group on the reflection
Please sign in to comment.
Something went wrong with that request. Please try again.