aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/associations/association_collection.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb
index 1221a56bbc..91e0a9f2f8 100644
--- a/activerecord/lib/active_record/associations/association_collection.rb
+++ b/activerecord/lib/active_record/associations/association_collection.rb
@@ -338,13 +338,12 @@ module ActiveRecord
def uniq(collection = self)
seen = Set.new
- collection.inject([]) do |kept, record|
+ collection.map do |record|
unless seen.include?(record.id)
- kept << record
seen << record.id
+ record
end
- kept
- end
+ end.compact
end
# Replace this collection with +other_array+