diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-10-14 15:49:08 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-10-14 17:30:29 -0700 |
commit | 396b1951fc91e5aecf499ca5602995f61cda59a3 (patch) | |
tree | 935f58db7c031a4b2392a55bd901555f24dd5774 | |
parent | e95bc57208ed5a88ce30b92fb6a5ff4969a6de02 (diff) | |
download | rails-396b1951fc91e5aecf499ca5602995f61cda59a3.tar.gz rails-396b1951fc91e5aecf499ca5602995f61cda59a3.tar.bz2 rails-396b1951fc91e5aecf499ca5602995f61cda59a3.zip |
read the association instead of sending
-rw-r--r-- | activerecord/lib/active_record/associations/preloader/through_association.rb | 4 |
1 files changed, 3 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 21f2fb7cc7..2a8530af62 100644 --- a/activerecord/lib/active_record/associations/preloader/through_association.rb +++ b/activerecord/lib/active_record/associations/preloader/through_association.rb @@ -47,7 +47,9 @@ module ActiveRecord records_by_owner[lhs] = pl_to_middle.flat_map do |pl, middles| rhs_records = middles.flat_map { |r| - r.send(source_reflection.name) + association = r.association source_reflection.name + + association.reader }.compact rhs_records.sort_by { |rhs| record_offset[rhs] } |