diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-09-20 13:17:36 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-09-20 13:17:36 -0700 |
commit | 931a6aba363e9ef70c8dec368d332a279e6bbfd9 (patch) | |
tree | 0c21e8b7fcfd6eb57ceda759bcbfe3243e068bbd /activerecord/lib | |
parent | a04965b40e0edc4ab093276cea6353f55199c3de (diff) | |
download | rails-931a6aba363e9ef70c8dec368d332a279e6bbfd9.tar.gz rails-931a6aba363e9ef70c8dec368d332a279e6bbfd9.tar.bz2 rails-931a6aba363e9ef70c8dec368d332a279e6bbfd9.zip |
lhs preload is always a single preload, so just preload one
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/associations/preloader.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations/preloader.rb b/activerecord/lib/active_record/associations/preloader.rb index dca7179953..1be5de708e 100644 --- a/activerecord/lib/active_record/associations/preloader.rb +++ b/activerecord/lib/active_record/associations/preloader.rb @@ -112,10 +112,10 @@ module ActiveRecord 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 |