diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-05-16 17:07:21 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-05-22 21:25:02 +0100 |
commit | d7a910e31e839e5544aa9f83f9922ecfcee74ed5 (patch) | |
tree | e27b725c1805246b2dd07aabec5fda5caf8d259e /activerecord/test/cases | |
parent | 8c19ebe5539fae896a1a6fb2549e9e63445b6607 (diff) | |
download | rails-d7a910e31e839e5544aa9f83f9922ecfcee74ed5.tar.gz rails-d7a910e31e839e5544aa9f83f9922ecfcee74ed5.tar.bz2 rails-d7a910e31e839e5544aa9f83f9922ecfcee74ed5.zip |
Fix problem with loading polymorphic associations which have been defined in an abstract superclass. Fixes #552.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/associations/has_many_associations_test.rb | 7 | ||||
-rw-r--r-- | activerecord/test/cases/reflection_test.rb | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index 522ac56d82..43974fd895 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -11,6 +11,7 @@ require 'models/comment' require 'models/person' require 'models/reader' require 'models/tagging' +require 'models/tag' require 'models/invoice' require 'models/line_item' require 'models/car' @@ -1468,4 +1469,10 @@ class HasManyAssociationsTest < ActiveRecord::TestCase bulb = car.bulbs.build({ :bulb_type => :custom }, :as => :admin) assert_equal CustomBulb, bulb.class end + + def test_abstract_class_with_polymorphic_has_many + post = SubStiPost.create! :title => "fooo", :body => "baa" + tagging = Tagging.create! :taggable => post + assert_equal [tagging], post.taggings + end end diff --git a/activerecord/test/cases/reflection_test.rb b/activerecord/test/cases/reflection_test.rb index 97d9669483..7e4ae1ea8d 100644 --- a/activerecord/test/cases/reflection_test.rb +++ b/activerecord/test/cases/reflection_test.rb @@ -216,7 +216,7 @@ class ReflectionTest < ActiveRecord::TestCase def test_conditions expected = [ [{ :tags => { :name => 'Blue' } }], - [{ :taggings => { :comment => 'first' } }, { "taggable_type" => "Post" }], + [{ :taggings => { :comment => 'first' } }], [{ :posts => { :title => ['misc post by bob', 'misc post by mary'] } }] ] actual = Author.reflect_on_association(:misc_post_first_blue_tags).conditions @@ -224,7 +224,7 @@ class ReflectionTest < ActiveRecord::TestCase expected = [ [{ :tags => { :name => 'Blue' } }, { :taggings => { :comment => 'first' } }, { :posts => { :title => ['misc post by bob', 'misc post by mary'] } }], - [{ "taggable_type" => "Post" }], + [], [] ] actual = Author.reflect_on_association(:misc_post_first_blue_tags_2).conditions |