aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/nested_has_many_through_associations_test.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2010-10-02 21:45:46 +0100
committerJon Leighton <j@jonathanleighton.com>2010-10-02 21:45:46 +0100
commita34391c3b495bad268204bdf4f6b3483a61abcd5 (patch)
tree7e6cb70fbe87bfde123b4aef097d85d5ea81015f /activerecord/test/cases/associations/nested_has_many_through_associations_test.rb
parent34ee586e993ad9e466b81f376fa92feb5d312b4c (diff)
downloadrails-a34391c3b495bad268204bdf4f6b3483a61abcd5.tar.gz
rails-a34391c3b495bad268204bdf4f6b3483a61abcd5.tar.bz2
rails-a34391c3b495bad268204bdf4f6b3483a61abcd5.zip
Add support for table aliasing, with a test that needs aliasing in order to work correctly. This test incidentally provides a more complicated test case (4 inner joins, 2 using polymorphism).
Diffstat (limited to 'activerecord/test/cases/associations/nested_has_many_through_associations_test.rb')
-rw-r--r--activerecord/test/cases/associations/nested_has_many_through_associations_test.rb5
1 files changed, 5 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 938643b1b3..925a9598fb 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
@@ -40,4 +40,9 @@ class NestedHasManyThroughAssociationsTest < ActiveRecord::TestCase
author = authors(:david)
assert_equal [subscribers(:first), subscribers(:second)], author.distinct_subscribers
end
+
+ def test_nested_has_many_through_with_a_table_referenced_multiple_times
+ author = authors(:bob)
+ assert_equal [posts(:misc_by_bob), posts(:misc_by_mary)], author.similar_posts.sort_by(&:id)
+ end
end