aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/associations
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2007-08-16 04:37:31 +0000
committerMichael Koziarski <michael@koziarski.com>2007-08-16 04:37:31 +0000
commitf008566d656fb3b86c6421520ffcd05828a2108f (patch)
tree0d4e1782a3dfc21fc628b34425da9921b6da5774 /activerecord/test/associations
parent82b244e3ffb55b94597b0562919522625ebfd2d3 (diff)
downloadrails-f008566d656fb3b86c6421520ffcd05828a2108f.tar.gz
rails-f008566d656fb3b86c6421520ffcd05828a2108f.tar.bz2
rails-f008566d656fb3b86c6421520ffcd05828a2108f.zip
Don't clobber :includes passed to count on has_many association. Closes #9175 [danger]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7326 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/associations')
-rw-r--r--activerecord/test/associations/eager_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/associations/eager_test.rb b/activerecord/test/associations/eager_test.rb
index 114da92542..019d361f3d 100644
--- a/activerecord/test/associations/eager_test.rb
+++ b/activerecord/test/associations/eager_test.rb
@@ -168,6 +168,12 @@ class EagerAssociationTest < Test::Unit::TestCase
posts = Post.find(:all, :include => [ :author, :comments ], :limit => 2, :conditions => "posts.title = 'magic forest'")
assert_equal 0, posts.size
end
+
+ def test_eager_count_performed_on_a_has_many_association_with_multi_table_conditional
+ author = authors(:david)
+ author_posts_without_comments = author.posts.select { |post| post.comments.blank? }
+ assert_equal author_posts_without_comments.size, author.posts.count(:all, :include => :comments, :conditions => 'comments.id is null')
+ end
def test_eager_with_has_and_belongs_to_many_and_limit
posts = Post.find(:all, :include => :categories, :order => "posts.id", :limit => 3)