From 8203a2afc1b43ca884675a1bc30d0023e9c19c99 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 27 Feb 2006 04:45:36 +0000 Subject: Dont require association classes before theyre supposed to be used (closes #3976) [Rick Olson] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3681 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/associations.rb | 13 ++----------- activerecord/lib/active_record/reflection.rb | 4 ---- 2 files changed, 2 insertions(+), 15 deletions(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index b8f933ee6c..0c7e647628 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -891,10 +891,7 @@ module ActiveRecord options[:extend] = create_extension_module(association_id, extension) if block_given? - reflection = create_reflection(:has_many, association_id, options, self) - reflection.require_class - - reflection + create_reflection(:has_many, association_id, options, self) end def create_has_one_reflection(association_id, options) @@ -902,10 +899,7 @@ module ActiveRecord :class_name, :foreign_key, :remote, :conditions, :order, :include, :dependent, :counter_cache, :extend, :as ) - reflection = create_reflection(:has_one, association_id, options, self) - reflection.require_class - - reflection + create_reflection(:has_one, association_id, options, self) end def create_belongs_to_reflection(association_id, options) @@ -918,8 +912,6 @@ module ActiveRecord if options[:polymorphic] reflection.options[:foreign_type] ||= reflection.class_name.underscore + "_type" - else - reflection.require_class end reflection @@ -937,7 +929,6 @@ module ActiveRecord options[:extend] = create_extension_module(association_id, extension) if block_given? reflection = create_reflection(:has_and_belongs_to_many, association_id, options, self) - reflection.require_class reflection.options[:join_table] ||= join_table_name(undecorated_table_name(self.to_s), undecorated_table_name(reflection.class_name)) diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index 774df46246..4d84cd1012 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -85,10 +85,6 @@ module ActiveRecord @class_name ||= name_to_class_name(name.id2name) end - def require_class - require_association(class_name.underscore) if class_name - end - def ==(other_aggregation) name == other_aggregation.name && other_aggregation.options && active_record == other_aggregation.active_record end -- cgit v1.2.3