From 8732ce291b6048a4eb80748ea3f404f495b7104c Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 19 Dec 2006 19:23:56 +0000 Subject: Subclass instantiation doesn't try to explicitly require the corresponding subclass. Closes #6840. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5751 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/associations.rb | 4 ---- activerecord/lib/active_record/base.rb | 8 +++----- 2 files changed, 3 insertions(+), 9 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 05eaf7b458..8a1768dba6 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -947,10 +947,6 @@ module ActiveRecord end end - def require_association_class(class_name) - require_association(Inflector.underscore(class_name)) if class_name - end - def add_multiple_associated_save_callbacks(association_name) method_name = "validate_associated_records_for_#{association_name}".to_sym define_method(method_name) do diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 08df7e6f2e..b0ff70e5af 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1054,8 +1054,6 @@ module ActiveRecord #:nodoc: allocate else - require_association_class(subclass_name) - # Ignore type if no column is present since it was probably # pulled in from a sloppy join. unless columns_hash.include?(inheritance_column) @@ -1354,9 +1352,9 @@ module ActiveRecord #:nodoc: def compute_type(type_name) modularized_name = type_name_with_module(type_name) begin - instance_eval(modularized_name) - rescue NameError => e - instance_eval(type_name) + class_eval(modularized_name, __FILE__, __LINE__) + rescue NameError + class_eval(type_name, __FILE__, __LINE__) end end -- cgit v1.2.3