mirror of https://github.com/rails/rails
Moved the global require_* out of the classes so they actually work without stack overflows
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@33 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
d82f73ecab
commit
d6d875bfb4
|
@ -5,6 +5,10 @@ require 'action_controller/support/class_attribute_accessors'
|
|||
require 'action_controller/support/class_inheritable_attributes'
|
||||
require 'action_controller/support/inflector'
|
||||
|
||||
unless Object.respond_to?(:require_dependency)
|
||||
Object.send(:define_method, :require_dependency) { |file_name| ActionController::Base.require_dependency(file_name) }
|
||||
end
|
||||
|
||||
module ActionController #:nodoc:
|
||||
class ActionControllerError < StandardError #:nodoc:
|
||||
end
|
||||
|
@ -259,8 +263,6 @@ module ActionController #:nodoc:
|
|||
def require_dependency(file_name)
|
||||
reload_dependencies ? silence_warnings { load("#{file_name}.rb") } : require(file_name)
|
||||
end
|
||||
|
||||
Object.send(:define_method, :require_dependency) { |file_name| ActiveRecord::Base.require_dependency(file_name) }
|
||||
end
|
||||
|
||||
public
|
||||
|
|
|
@ -3,6 +3,10 @@ require 'active_record/support/class_inheritable_attributes'
|
|||
require 'active_record/support/inflector'
|
||||
require 'yaml'
|
||||
|
||||
unless Object.respond_to?(:require_association)
|
||||
Object.send(:define_method, :require_association) { |file_name| ActiveRecord::Base.require_association(file_name) }
|
||||
end
|
||||
|
||||
module ActiveRecord #:nodoc:
|
||||
class ActiveRecordError < StandardError #:nodoc:
|
||||
end
|
||||
|
@ -553,9 +557,7 @@ module ActiveRecord #:nodoc:
|
|||
end
|
||||
end
|
||||
|
||||
Object.send(:define_method, :require_association) { |file_name| ActiveRecord::Base.require_association(file_name) }
|
||||
|
||||
# Resets the list of dependencies loaded (typically to be called by the end of a request), so when require_or_load is
|
||||
# Resets the list of dependencies loaded (typically to be called by the end of a request), so when require_association is
|
||||
# called for that dependency it'll be loaded anew.
|
||||
def reset_associations_loaded
|
||||
associations_loaded = []
|
||||
|
|
Loading…
Reference in New Issue