From 66e97c34c116bbf0e7b87802e81a9f7df0684b47 Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Tue, 11 Dec 2007 20:08:30 +0000 Subject: Ensure that the :uniq option for has_many :through associations retains the order. #10463 [remvee] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8376 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../lib/active_record/associations/has_many_through_association.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/associations/has_many_through_association.rb b/activerecord/lib/active_record/associations/has_many_through_association.rb index 06b1276860..14f752abe4 100644 --- a/activerecord/lib/active_record/associations/has_many_through_association.rb +++ b/activerecord/lib/active_record/associations/has_many_through_association.rb @@ -148,7 +148,8 @@ module ActiveRecord :include => @reflection.options[:include] || @reflection.source_reflection.options[:include] ) - @reflection.options[:uniq] ? records.to_set.to_a : records + records.uniq! if @reflection.options[:uniq] + records end # Construct attributes for associate pointing to owner. -- cgit v1.2.3