1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Moved subclass reloading responsibilities to Dependencies

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@509 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson 2005-01-25 18:20:23 +00:00
parent 20b14e0d38
commit be80d460f7
2 changed files with 5 additions and 3 deletions

View file

@ -35,6 +35,10 @@ module Dependencies
def require_or_load(file_name) def require_or_load(file_name)
load? ? load("#{file_name}.rb") : require(file_name) load? ? load("#{file_name}.rb") : require(file_name)
end end
def remove_subclasses_for(*classes)
classes.each { |klass| klass.remove_subclasses }
end
end end
Object.send(:define_method, :require_or_load) { |file_name| Dependencies.require_or_load(file_name) } unless Object.respond_to?(:require_or_load) Object.send(:define_method, :require_or_load) { |file_name| Dependencies.require_or_load(file_name) } unless Object.respond_to?(:require_or_load)

View file

@ -49,9 +49,7 @@ class Dispatcher
private private
def reset_application def reset_application
Dependencies.clear Dependencies.clear
ActiveRecord::Base.remove_subclasses Dependencies.remove_subclasses_for(ActiveRecord::Base, ActiveRecord::Observer, ActionController::Base)
ActiveRecord::Observer.remove_subclasses
ActionController::Base.remove_subclasses
end end
def controller_path(controller_name, module_name = nil) def controller_path(controller_name, module_name = nil)