Skip to content

Commit

Permalink
Merge pull request #4093 from arunagw/issue_3183
Browse files Browse the repository at this point in the history
More tests deep including through habtm
  • Loading branch information
josevalim committed Dec 21, 2011
2 parents 28e869d + e3c383c commit 893d38d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions activerecord/test/cases/associations/eager_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 893d38d

Please sign in to comment.