aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-02-27 04:45:36 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-02-27 04:45:36 +0000
commit8203a2afc1b43ca884675a1bc30d0023e9c19c99 (patch)
treea50533f1769491605a3a30250ab18e9d93465b35 /activerecord/lib
parent985cb441103c79651f12a013326aa15f54fa8182 (diff)
downloadrails-8203a2afc1b43ca884675a1bc30d0023e9c19c99.tar.gz
rails-8203a2afc1b43ca884675a1bc30d0023e9c19c99.tar.bz2
rails-8203a2afc1b43ca884675a1bc30d0023e9c19c99.zip
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
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-xactiverecord/lib/active_record/associations.rb13
-rw-r--r--activerecord/lib/active_record/reflection.rb4
2 files changed, 2 insertions, 15 deletions
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