aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-09-20 17:09:48 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-09-20 17:09:48 -0700
commitbc77ccacbd7fe31a596be2b05a88048f2b832549 (patch)
tree74525ca4c02e8e108fd1958442ef1126d6dbf73e /activerecord/lib
parent7f55ef8c4dee5b26a9174d7dc2ebcbc6bb93af06 (diff)
downloadrails-bc77ccacbd7fe31a596be2b05a88048f2b832549.tar.gz
rails-bc77ccacbd7fe31a596be2b05a88048f2b832549.tar.bz2
rails-bc77ccacbd7fe31a596be2b05a88048f2b832549.zip
split up construction and mutation
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/associations/preloader/through_association.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/preloader/through_association.rb b/activerecord/lib/active_record/associations/preloader/through_association.rb
index 2c625cec04..3001177d15 100644
--- a/activerecord/lib/active_record/associations/preloader/through_association.rb
+++ b/activerecord/lib/active_record/associations/preloader/through_association.rb
@@ -14,7 +14,10 @@ module ActiveRecord
def associated_records_by_owner
through_records = through_records_by_owner
- Preloader.new(through_records.values.flatten, source_reflection.name, reflection_scope).run
+ preloader = Preloader.new(through_records.values.flatten,
+ source_reflection.name,
+ reflection_scope)
+ preloader.run
through_records.each do |owner, records|
records.map! { |r| r.send(source_reflection.name) }.flatten!