diff options
author | Dmitry Vorotilin <d.vorotilin@gmail.com> | 2013-03-01 02:32:38 +0400 |
---|---|---|
committer | Dmitry Vorotilin <d.vorotilin@gmail.com> | 2013-03-06 11:46:07 +0400 |
commit | b04051d4e0c8066ec79cd4978606e4728dfa6ffa (patch) | |
tree | f5e3078bf8bfc31de0e65541489b3294642ab772 /activerecord/test/cases | |
parent | ee169329a898d993f0d024af6cce83649fb2f733 (diff) | |
download | rails-b04051d4e0c8066ec79cd4978606e4728dfa6ffa.tar.gz rails-b04051d4e0c8066ec79cd4978606e4728dfa6ffa.tar.bz2 rails-b04051d4e0c8066ec79cd4978606e4728dfa6ffa.zip |
Fix ActiveRecord `subclass_from_attrs` when eager_load is false.
It cannot find subclass because all classes are loaded automatically
when it needs.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/inheritance_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/test/cases/inheritance_test.rb b/activerecord/test/cases/inheritance_test.rb index 189066eb41..b91146db4e 100644 --- a/activerecord/test/cases/inheritance_test.rb +++ b/activerecord/test/cases/inheritance_test.rb @@ -179,6 +179,17 @@ class InheritanceTest < ActiveRecord::TestCase assert_raise(ActiveRecord::SubclassNotFound) { Company.new(:type => 'Account') } end + def test_new_with_autoload_paths + path = File.expand_path('../../models/autoloadable', __FILE__) + ActiveSupport::Dependencies.autoload_paths << path + + firm = Company.new(:type => 'ExtraFirm') + assert_equal ExtraFirm, firm.class + ensure + ActiveSupport::Dependencies.autoload_paths.reject! { |p| p == path } + ActiveSupport::Dependencies.clear + end + def test_inheritance_condition assert_equal 10, Company.count assert_equal 2, Firm.count |