aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/associations/join_model_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/associations/join_model_test.rb')
-rw-r--r--activerecord/test/associations/join_model_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/associations/join_model_test.rb b/activerecord/test/associations/join_model_test.rb
index 1d2a4f6c5c..a5e525c670 100644
--- a/activerecord/test/associations/join_model_test.rb
+++ b/activerecord/test/associations/join_model_test.rb
@@ -300,6 +300,18 @@ class AssociationsJoinModelTest < Test::Unit::TestCase
assert_equal [posts(:welcome), posts(:thinking)], tags(:general).taggings.find(:all, :include => :taggable)
end
end
+
+ def test_has_many_polymorphic_with_source_type
+ assert_equal [posts(:welcome), posts(:thinking)], tags(:general).tagged_posts
+ end
+
+ def test_eager_has_many_polymorphic_with_source_type
+ tag_with_include = Tag.find(tags(:general).id, :include => :tagged_posts)
+ desired = [posts(:welcome), posts(:thinking)]
+ assert_no_queries do
+ assert_equal desired, tag_with_include.tagged_posts
+ end
+ end
def test_has_many_through_has_many_find_all
assert_equal comments(:greetings), authors(:david).comments.find(:all, :order => 'comments.id').first