diff options
author | Rick Olson <technoweenie@gmail.com> | 2006-07-28 23:09:29 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2006-07-28 23:09:29 +0000 |
commit | 2e88b5d37feb5f0b1554e70dc18b9fbc67e68877 (patch) | |
tree | c2e4c7980b4495bfaca78e26a5de15086217123b /railties/lib | |
parent | 99e9faeda8f039d34e9eeab319e8adc13cb9bc86 (diff) | |
download | rails-2e88b5d37feb5f0b1554e70dc18b9fbc67e68877.tar.gz rails-2e88b5d37feb5f0b1554e70dc18b9fbc67e68877.tar.bz2 rails-2e88b5d37feb5f0b1554e70dc18b9fbc67e68877.zip |
Fixed the failsafe response so it uses either the current recognized controller or ApplicationController. [Rick Olson]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4629 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/dispatcher.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/railties/lib/dispatcher.rb b/railties/lib/dispatcher.rb index f43dc9f4c8..f4cb52b3b7 100644 --- a/railties/lib/dispatcher.rb +++ b/railties/lib/dispatcher.rb @@ -32,14 +32,17 @@ class Dispatcher # own CGI object be sure to handle the exceptions it raises on multipart # requests (EOFError and ArgumentError). def dispatch(cgi = nil, session_options = ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, output = $stdout) + controller = nil if cgi ||= new_cgi(output) request, response = ActionController::CgiRequest.new(cgi, session_options), ActionController::CgiResponse.new(cgi) prepare_application - ActionController::Routing::Routes.recognize(request).process(request, response).out(output) + controller = ActionController::Routing::Routes.recognize(request) + controller.process(request, response).out(output) end rescue Object => exception failsafe_response(output, '500 Internal Server Error', exception) do - ActionController.process_with_exception(request, response, exception).out(output) + controller ||= const_defined?(:ApplicationController) ? ApplicationController : ActionController::Base + controller.process_with_exception(request, response, exception).out(output) end ensure # Do not give a failsafe response here. |