Permalink
Browse files

Fixed that :includes merged from with_scope won't cause the same asso…

…ciation to be loaded more than once if repetition occurs in the clauses (closes #5253) [alex@purefiction.net]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4415 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 9422e71 commit 01a52dd1ad51034b10a8386db7b1aae83f32a59d @dhh dhh committed Jun 3, 2006
Showing with 4 additions and 1 deletion.
  1. +3 −0 activerecord/CHANGELOG
  2. +1 −1 activerecord/lib/active_record/base.rb
View
3 activerecord/CHANGELOG
@@ -1,9 +1,12 @@
*SVN*
+* Fixed that :includes merged from with_scope won't cause the same association to be loaded more than once if repetition occurs in the clauses #5253 [alex@purefiction.net]
+
* Allow models to override to_xml. #4989 [Blair Zajac <blair@orcaware.com>]
* PostgreSQL: don't ignore port when host is nil since it's often used to label the domain socket. #5247 [shimbo@is.naist.jp]
+>>>>>>> .r4414
* Records and arrays of records are bound as quoted ids. [Jeremy Kemper]
Foo.find(:all, :conditions => ['bar_id IN (?)', bars])
Foo.find(:first, :conditions => ['bar_id = ?', bar])
View
2 activerecord/lib/active_record/base.rb
@@ -1022,7 +1022,7 @@ def construct_finder_sql(options)
# Merges includes so that the result is a valid +include+
def merge_includes(first, second)
- safe_to_array(first) + safe_to_array(second)
+ (safe_to_array(first) + safe_to_array(second)).uniq
end
# Object#to_a is deprecated, though it does have the desired behavior

0 comments on commit 01a52dd

Please sign in to comment.