mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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
This commit is contained in:
parent
985cb44110
commit
8203a2afc1
2 changed files with 2 additions and 15 deletions
|
@ -891,10 +891,7 @@ module ActiveRecord
|
||||||
|
|
||||||
options[:extend] = create_extension_module(association_id, extension) if block_given?
|
options[:extend] = create_extension_module(association_id, extension) if block_given?
|
||||||
|
|
||||||
reflection = create_reflection(:has_many, association_id, options, self)
|
create_reflection(:has_many, association_id, options, self)
|
||||||
reflection.require_class
|
|
||||||
|
|
||||||
reflection
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_has_one_reflection(association_id, options)
|
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
|
:class_name, :foreign_key, :remote, :conditions, :order, :include, :dependent, :counter_cache, :extend, :as
|
||||||
)
|
)
|
||||||
|
|
||||||
reflection = create_reflection(:has_one, association_id, options, self)
|
create_reflection(:has_one, association_id, options, self)
|
||||||
reflection.require_class
|
|
||||||
|
|
||||||
reflection
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_belongs_to_reflection(association_id, options)
|
def create_belongs_to_reflection(association_id, options)
|
||||||
|
@ -918,8 +912,6 @@ module ActiveRecord
|
||||||
|
|
||||||
if options[:polymorphic]
|
if options[:polymorphic]
|
||||||
reflection.options[:foreign_type] ||= reflection.class_name.underscore + "_type"
|
reflection.options[:foreign_type] ||= reflection.class_name.underscore + "_type"
|
||||||
else
|
|
||||||
reflection.require_class
|
|
||||||
end
|
end
|
||||||
|
|
||||||
reflection
|
reflection
|
||||||
|
@ -937,7 +929,6 @@ module ActiveRecord
|
||||||
options[:extend] = create_extension_module(association_id, extension) if block_given?
|
options[:extend] = create_extension_module(association_id, extension) if block_given?
|
||||||
|
|
||||||
reflection = create_reflection(:has_and_belongs_to_many, association_id, options, self)
|
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))
|
reflection.options[:join_table] ||= join_table_name(undecorated_table_name(self.to_s), undecorated_table_name(reflection.class_name))
|
||||||
|
|
||||||
|
|
|
@ -85,10 +85,6 @@ module ActiveRecord
|
||||||
@class_name ||= name_to_class_name(name.id2name)
|
@class_name ||= name_to_class_name(name.id2name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def require_class
|
|
||||||
require_association(class_name.underscore) if class_name
|
|
||||||
end
|
|
||||||
|
|
||||||
def ==(other_aggregation)
|
def ==(other_aggregation)
|
||||||
name == other_aggregation.name && other_aggregation.options && active_record == other_aggregation.active_record
|
name == other_aggregation.name && other_aggregation.options && active_record == other_aggregation.active_record
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue