diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-09-25 10:40:50 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-09-25 10:40:50 -0700 |
commit | 57112fb7e7cb72584010b0957dfce91e0fc80a12 (patch) | |
tree | 5af59eeab4bb23d42d5dc56166bcff05bcada0c0 /activerecord/lib/active_record/associations/preloader/has_many_through.rb | |
parent | be91bb26408cadf3522eb8b8798f2118920cd1eb (diff) | |
download | rails-57112fb7e7cb72584010b0957dfce91e0fc80a12.tar.gz rails-57112fb7e7cb72584010b0957dfce91e0fc80a12.tar.bz2 rails-57112fb7e7cb72584010b0957dfce91e0fc80a12.zip |
always populate the preloaded records instance variable so we can remove
the @associated_records_by_owner ivar
Diffstat (limited to 'activerecord/lib/active_record/associations/preloader/has_many_through.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/preloader/has_many_through.rb | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations/preloader/has_many_through.rb b/activerecord/lib/active_record/associations/preloader/has_many_through.rb index 341e73f127..7b37b5942d 100644 --- a/activerecord/lib/active_record/associations/preloader/has_many_through.rb +++ b/activerecord/lib/active_record/associations/preloader/has_many_through.rb @@ -5,15 +5,13 @@ module ActiveRecord include ThroughAssociation def associated_records_by_owner(preloader) - return @associated_records_by_owner if @associated_records_by_owner - records_by_owner = super if reflection_scope.distinct_value records_by_owner.each_value { |records| records.uniq! } end - @associated_records_by_owner = records_by_owner + records_by_owner end end end |