aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-12-21 03:21:49 -0800
committerJosé Valim <jose.valim@gmail.com>2011-12-21 03:21:49 -0800
commit893d38d7fde27b52f2b92579a1db59dc1e5e5a07 (patch)
treed7b647abdde8b6430c0ee24284dc2e8dfae9516b
parent28e869d77ee8515c2fe21c6052d33ab41479a47e (diff)
parente3c383cd82842df186924ecdf6a7c68d69c79758 (diff)
downloadrails-893d38d7fde27b52f2b92579a1db59dc1e5e5a07.tar.gz
rails-893d38d7fde27b52f2b92579a1db59dc1e5e5a07.tar.bz2
rails-893d38d7fde27b52f2b92579a1db59dc1e5e5a07.zip
Merge pull request #4093 from arunagw/issue_3183
More tests deep including through habtm
-rw-r--r--activerecord/test/cases/associations/eager_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb
index 1dc71ac4cc..3d759e64f8 100644
--- a/activerecord/test/cases/associations/eager_test.rb
+++ b/activerecord/test/cases/associations/eager_test.rb
@@ -1095,4 +1095,11 @@ class EagerAssociationTest < ActiveRecord::TestCase
Post.includes(:comments).order(nil).where(:comments => {:body => "Thank you for the welcome"}).first
end
end
+
+ def test_deep_including_through_habtm
+ posts = Post.find(:all, :include => {:categories => :categorizations}, :order => "posts.id")
+ assert_no_queries { assert_equal 2, posts[0].categories[0].categorizations.length }
+ assert_no_queries { assert_equal 1, posts[0].categories[1].categorizations.length }
+ assert_no_queries { assert_equal 2, posts[1].categories[0].categorizations.length }
+ end
end