From 0c3c131f3b9a82d3e2f36b2930c3437c9f821b6d Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 8 Oct 2006 06:45:32 +0000 Subject: The has_many create method works with polymorphic associations. Closes #6361. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5230 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/associations/join_model_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'activerecord/test') diff --git a/activerecord/test/associations/join_model_test.rb b/activerecord/test/associations/join_model_test.rb index fb8df9c21c..c67956fba3 100644 --- a/activerecord/test/associations/join_model_test.rb +++ b/activerecord/test/associations/join_model_test.rb @@ -137,6 +137,13 @@ class AssociationsJoinModelTest < Test::Unit::TestCase assert_equal "Post", tagging.taggable_type assert_equal old_count+1, posts(:welcome).taggings.count end + + def test_create_bang_polymorphic_with_has_many_scope + old_count = posts(:welcome).taggings.count + tagging = posts(:welcome).taggings.create!(:tag => tags(:misc)) + assert_equal "Post", tagging.taggable_type + assert_equal old_count+1, posts(:welcome).taggings.count + end def test_create_polymorphic_has_one_with_scope old_count = Tagging.count -- cgit v1.2.3