diff options
-rw-r--r-- | activerecord/test/associations_join_model_test.rb | 8 | ||||
-rw-r--r-- | activerecord/test/fixtures/tag.rb | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/associations_join_model_test.rb b/activerecord/test/associations_join_model_test.rb index f8d8b77813..a011a0fae8 100644 --- a/activerecord/test/associations_join_model_test.rb +++ b/activerecord/test/associations_join_model_test.rb @@ -39,6 +39,14 @@ class AssociationsJoinModelTest < Test::Unit::TestCase assert_equal tags(:general), posts(:thinking).tags.first end + def test_polymorphic_has_many_create_model_with_inheritance + post = posts(:thinking) + assert_instance_of SpecialPost, post + + tagging = tags(:misc).taggings.create(:taggable => post) + assert_equal "Post", tagging.taggable_type + end + def test_has_many_with_piggyback assert_equal "2", categories(:sti_test).authors.first.post_id.to_s end diff --git a/activerecord/test/fixtures/tag.rb b/activerecord/test/fixtures/tag.rb index bfd81c69f7..d54f3cd680 100644 --- a/activerecord/test/fixtures/tag.rb +++ b/activerecord/test/fixtures/tag.rb @@ -1,2 +1,3 @@ class Tag < ActiveRecord::Base + has_many :taggings, :as => :taggable end
\ No newline at end of file |