aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/inheritance_test.rb
diff options
context:
space:
mode:
authorDmitry Vorotilin <d.vorotilin@gmail.com>2013-03-01 02:32:38 +0400
committerDmitry Vorotilin <d.vorotilin@gmail.com>2013-03-06 11:46:07 +0400
commitb04051d4e0c8066ec79cd4978606e4728dfa6ffa (patch)
treef5e3078bf8bfc31de0e65541489b3294642ab772 /activerecord/test/cases/inheritance_test.rb
parentee169329a898d993f0d024af6cce83649fb2f733 (diff)
downloadrails-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/inheritance_test.rb')
-rw-r--r--activerecord/test/cases/inheritance_test.rb11
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