diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2014-01-14 07:05:54 -0800 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2014-01-14 07:05:54 -0800 |
commit | 8a60f479b0580e88bae77c0ab3dd9e95082cb437 (patch) | |
tree | cc13fee530ff0a6045b8a4acb58e9a96e4b818cc /activerecord/test/cases/inheritance_test.rb | |
parent | b242b2dbe75f0b5e86e2ce9ef7c2c5ee96e17862 (diff) | |
parent | e8d1d84837a59ef7d73b29b16ee05cd610d30a90 (diff) | |
download | rails-8a60f479b0580e88bae77c0ab3dd9e95082cb437.tar.gz rails-8a60f479b0580e88bae77c0ab3dd9e95082cb437.tar.bz2 rails-8a60f479b0580e88bae77c0ab3dd9e95082cb437.zip |
Merge pull request #13710 from ujjwalt/hotfix/sti
Active Record's subclass_from_attributes shouldn't assume :type is for STI unless there is a type column.
Diffstat (limited to 'activerecord/test/cases/inheritance_test.rb')
-rw-r--r-- | activerecord/test/cases/inheritance_test.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/activerecord/test/cases/inheritance_test.rb b/activerecord/test/cases/inheritance_test.rb index 7fd7d42354..d2b5a06b55 100644 --- a/activerecord/test/cases/inheritance_test.rb +++ b/activerecord/test/cases/inheritance_test.rb @@ -1,10 +1,11 @@ -require "cases/helper" +require 'cases/helper' require 'models/company' require 'models/person' require 'models/post' require 'models/project' require 'models/subscriber' require 'models/vegetables' +require 'models/shop' class InheritanceTest < ActiveRecord::TestCase fixtures :companies, :projects, :subscribers, :accounts, :vegetables @@ -367,4 +368,10 @@ class InheritanceComputeTypeTest < ActiveRecord::TestCase ensure ActiveRecord::Base.store_full_sti_class = true end + + def test_sti_type_from_attributes_disabled_in_non_sti_class + phone = Shop::Product::Type.new(name: 'Phone') + product = Shop::Product.new(:type => phone) + assert product.save + end end |