diff options
author | José Valim <jose.valim@gmail.com> | 2010-02-16 22:09:42 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-02-16 22:39:07 +0100 |
commit | 72cb0bf4146444c80319503b5813b967454ec77d (patch) | |
tree | fef8935285a7defd7ce8b41db20509e96abc4d39 | |
parent | 01cd9d66ede0a528725728f2d73cf6e7796ccb02 (diff) | |
download | rails-72cb0bf4146444c80319503b5813b967454ec77d.tar.gz rails-72cb0bf4146444c80319503b5813b967454ec77d.tar.bz2 rails-72cb0bf4146444c80319503b5813b967454ec77d.zip |
Do not swallow controller loading errors unless required.
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index dcf98b729b..7092eb6cef 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -19,12 +19,7 @@ module ActionDispatch def call(env) params = env[PARAMETERS_KEY] prepare_params!(params) - - unless controller = controller(params) - return [404, {'X-Cascade' => 'pass'}, []] - end - - controller.action(params[:action]).call(env) + controller(params).action(params[:action]).call(env) end def prepare_params!(params) @@ -39,14 +34,13 @@ module ActionDispatch end end - def controller(params) + def controller(params, swallow=false) if params && params.has_key?(:controller) controller = "#{params[:controller].camelize}Controller" ActiveSupport::Inflector.constantize(controller) end rescue NameError => e - raise unless e.message.include?(controller) - nil + raise ActionController::RoutingError, e.message, e.backtrace unless swallow end private @@ -433,7 +427,7 @@ module ActionDispatch req = Rack::Request.new(env) @set.recognize(req) do |route, params| dispatcher = route.app - if dispatcher.is_a?(Dispatcher) && dispatcher.controller(params) + if dispatcher.is_a?(Dispatcher) && dispatcher.controller(params, true) dispatcher.prepare_params!(params) return params end |