diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-10-11 18:48:43 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-10-11 18:48:43 -0700 |
commit | b69b9de4bdd2d40334d4b1284d872f96a600789a (patch) | |
tree | eab4dff29d3e599de4f8de89d492d820cb2e02e1 | |
parent | cfbb6eeb4c778c974399c5196e1ecb9cdafca277 (diff) | |
download | rails-b69b9de4bdd2d40334d4b1284d872f96a600789a.tar.gz rails-b69b9de4bdd2d40334d4b1284d872f96a600789a.tar.bz2 rails-b69b9de4bdd2d40334d4b1284d872f96a600789a.zip |
the parent hash keeps the records unique already
-rw-r--r-- | activerecord/lib/active_record/associations/join_dependency.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb index 4daaec9d22..b147f0a847 100644 --- a/activerecord/lib/active_record/associations/join_dependency.rb +++ b/activerecord/lib/active_record/associations/join_dependency.rb @@ -105,14 +105,13 @@ module ActiveRecord } } - records = result_set.map { |row_hash| + result_set.each { |row_hash| primary_id = type_caster.type_cast row_hash[primary_key] parent = parents[primary_id] ||= join_root.instantiate(row_hash) construct(parent, join_root, row_hash, result_set, seen) - parent - }.uniq + } - records + parents.values end private |