aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorTu Hoang <rebyn@me.com>2014-10-15 20:25:09 +0700
committerTu Hoang <rebyn@me.com>2014-10-15 20:25:09 +0700
commitf260f9cd294f33301a4971e44a25cccdd95273d6 (patch)
tree8906f73f9220eb50d120d784ad5390fc7005ff09 /activerecord/test/cases
parent62f96c9e1fdfa5b832073f90e1fe592fbf3163bb (diff)
downloadrails-f260f9cd294f33301a4971e44a25cccdd95273d6.tar.gz
rails-f260f9cd294f33301a4971e44a25cccdd95273d6.tar.bz2
rails-f260f9cd294f33301a4971e44a25cccdd95273d6.zip
Raise an error for has_one associations which try to go :through a polymorphic association [#17263]
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/associations/has_one_through_associations_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_one_through_associations_test.rb b/activerecord/test/cases/associations/has_one_through_associations_test.rb
index 089cb0a3a2..19d1aa87a8 100644
--- a/activerecord/test/cases/associations/has_one_through_associations_test.rb
+++ b/activerecord/test/cases/associations/has_one_through_associations_test.rb
@@ -289,6 +289,12 @@ class HasOneThroughAssociationsTest < ActiveRecord::TestCase
end
end
+ def test_has_one_through_polymorphic_association
+ assert_raise(ActiveRecord::HasOneAssociationPolymorphicThroughError) do
+ @member.premium_club
+ end
+ end
+
def test_has_one_through_belongs_to_should_update_when_the_through_foreign_key_changes
minivan = minivans(:cool_first)