From e3c383cd82842df186924ecdf6a7c68d69c79758 Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Wed, 21 Dec 2011 16:16:55 +0530 Subject: [PATCH] More tests deep including through habtm fixes #3183 --- activerecord/test/cases/associations/eager_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) 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 @@ def test_join_eager_with_nil_order_should_generate_valid_sql 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