aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2010-10-05 20:20:27 +0100
committerJon Leighton <j@jonathanleighton.com>2010-10-05 20:20:27 +0100
commit3cc35633872a0072764d8edb20f1fc4e14adf729 (patch)
treeea7bb015a0282987bd2fe69cf6b6767ef1a1ad30
parent43711083dd34252877bab9df43d3db0fd42feeb2 (diff)
downloadrails-3cc35633872a0072764d8edb20f1fc4e14adf729.tar.gz
rails-3cc35633872a0072764d8edb20f1fc4e14adf729.tar.bz2
rails-3cc35633872a0072764d8edb20f1fc4e14adf729.zip
A failing test for a nested has many through association loaded via Foo.joins(:bar)
-rw-r--r--activerecord/test/cases/associations/nested_has_many_through_associations_test.rb6
1 files changed, 6 insertions, 0 deletions
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