aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2007-12-11 20:08:30 +0000
committerRick Olson <technoweenie@gmail.com>2007-12-11 20:08:30 +0000
commit66e97c34c116bbf0e7b87802e81a9f7df0684b47 (patch)
treec9cd3bcb8e58a6259194bf412a8434c0852a3411 /activerecord/lib
parentf67add4283069653f5707bd45cff214913dfc579 (diff)
downloadrails-66e97c34c116bbf0e7b87802e81a9f7df0684b47.tar.gz
rails-66e97c34c116bbf0e7b87802e81a9f7df0684b47.tar.bz2
rails-66e97c34c116bbf0e7b87802e81a9f7df0684b47.zip
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
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/associations/has_many_through_association.rb3
1 files changed, 2 insertions, 1 deletions
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.