From 3cc35633872a0072764d8edb20f1fc4e14adf729 Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Tue, 5 Oct 2010 20:20:27 +0100 Subject: A failing test for a nested has many through association loaded via Foo.joins(:bar) --- .../cases/associations/nested_has_many_through_associations_test.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'activerecord/test/cases') diff --git a/activerecord/test/cases/associations/nested_has_many_through_associations_test.rb b/activerecord/test/cases/associations/nested_has_many_through_associations_test.rb index 925a9598fb..a5d3f27702 100644 --- a/activerecord/test/cases/associations/nested_has_many_through_associations_test.rb +++ b/activerecord/test/cases/associations/nested_has_many_through_associations_test.rb @@ -45,4 +45,10 @@ class NestedHasManyThroughAssociationsTest < ActiveRecord::TestCase author = authors(:bob) assert_equal [posts(:misc_by_bob), posts(:misc_by_mary)], author.similar_posts.sort_by(&:id) end + + def test_nested_has_many_through_as_a_join + # All authors with subscribers where one of the subscribers' nick is 'alterself' + authors = Author.joins(:subscribers).where('subscribers.nick' => 'alterself') + assert_equal [authors(:david)], authors + end end -- cgit v1.2.3