diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-16 17:50:36 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-16 17:50:36 +0000 |
commit | ee014ef95ae9746b4228f3bc7c85ac0df28ba1df (patch) | |
tree | d60860f75c1dbeda5090b82259fcc45aa85e50c1 /railties/lib | |
parent | 394cf21ce73cae503f4c5272ef2a417df6fd21a5 (diff) | |
download | rails-ee014ef95ae9746b4228f3bc7c85ac0df28ba1df.tar.gz rails-ee014ef95ae9746b4228f3bc7c85ac0df28ba1df.tar.bz2 rails-ee014ef95ae9746b4228f3bc7c85ac0df28ba1df.zip |
New adventures in dependency reloading
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@429 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/dispatcher.rb | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/railties/lib/dispatcher.rb b/railties/lib/dispatcher.rb index 81c1ed9cb3..05cbab4265 100644 --- a/railties/lib/dispatcher.rb +++ b/railties/lib/dispatcher.rb @@ -24,13 +24,11 @@ require 'breakpoint' class Dispatcher - class <<self - def dispatch(cgi = CGI.new, session_options = ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS) - Breakpoint.activate_drb("druby://localhost:#{BREAKPOINT_SERVER_PORT}", nil, !defined?(FastCGI)) if defined?(BREAKPOINT_SERVER_PORT) - begin + Breakpoint.activate_drb("druby://localhost:#{BREAKPOINT_SERVER_PORT}", nil, !defined?(FastCGI)) if defined?(BREAKPOINT_SERVER_PORT) + request = ActionController::CgiRequest.new(cgi, session_options) response = ActionController::CgiResponse.new(cgi) @@ -38,25 +36,21 @@ class Dispatcher require_dependency("application") require_dependency(controller_path(controller_name, module_name)) - - reload_application rescue nil # Ignore out of order reloading errors for Controllers - + controller_class(controller_name).process(request, response).out rescue Object => exception ActionController::Base.process_with_exception(request, response, exception).out - ensure - remove_class_hierarchy(controller_class(controller_name), ActionController::Base) if Dependencies.mechanism == :load + ensure + reset_application(controller_name) if Dependencies.mechanism == :load Breakpoint.deactivate_drb if defined?(BREAKPOINT_SERVER_PORT) end end private - - def reload_application - if Dependencies.mechanism == :load - ActiveRecord::Base.reset_column_information_and_inheritable_attributes_for_all_subclasses - Dependencies.reload - end + def reset_application(controller_name) + ActiveRecord::Base.reset_column_information_and_inheritable_attributes_for_all_subclasses + Dependencies.clear + remove_class_hierarchy(controller_class(controller_name), ApplicationController) end def controller_path(controller_name, module_name = nil) |