diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-25 18:00:15 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-25 18:00:15 +0000 |
commit | ee662e9768f3682389daaa54d38c3e46cdcd4408 (patch) | |
tree | e98164fe1659358726b4ff30a6fab9ecc3abab8e /railties | |
parent | c37e8d365b9470a593668476fc9be0af6da2e812 (diff) | |
download | rails-ee662e9768f3682389daaa54d38c3e46cdcd4408.tar.gz rails-ee662e9768f3682389daaa54d38c3e46cdcd4408.tar.bz2 rails-ee662e9768f3682389daaa54d38c3e46cdcd4408.zip |
New approach to reloading that uses remove_const on ARs and AOs as well as ACs
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@507 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/dispatcher.rb | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/railties/lib/dispatcher.rb b/railties/lib/dispatcher.rb index 3fb593bd9d..84dff75024 100644 --- a/railties/lib/dispatcher.rb +++ b/railties/lib/dispatcher.rb @@ -34,8 +34,6 @@ class Dispatcher controller_name, module_name = controller_name(request.parameters), module_name(request.parameters) - reload_models - require_or_load("application") require_or_load(controller_path(controller_name, module_name)) @@ -43,23 +41,17 @@ class Dispatcher rescue Object => exception ActionController::Base.process_with_exception(request, response, exception).out ensure - remove_controllers(controller_name) + reset_application if Dependencies.load? Breakpoint.deactivate_drb if defined?(BREAKPOINT_SERVER_PORT) end end private - def reload_models - if Dependencies.load? - ActiveRecord::Base.reset_column_information_and_inheritable_attributes_for_all_subclasses - Dependencies.reload - end - end - - def remove_controllers(controller_name) - if Dependencies.load? && defined?(ApplicationController) - remove_class_hierarchy(controller_class(controller_name), ActionController::Base) - end + def reset_application + Dependencies.clear + ActiveRecord::Base.remove_subclasses + ActiveRecord::Observer.remove_subclasses + ActionController::Base.remove_subclasses end def controller_path(controller_name, module_name = nil) @@ -85,12 +77,5 @@ class Dispatcher def module_name(parameters) parameters["module"].downcase.gsub(/[^_a-zA-Z0-9]/, "").untaint if parameters["module"] end - - def remove_class_hierarchy(klass, until_superclass) - while klass - Object.send(:remove_const, "#{klass}".intern) - klass = (klass.superclass unless until_superclass == klass.superclass) - end - end end end
\ No newline at end of file |