aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb11
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb2
2 files changed, 6 insertions, 7 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 9656109ed3..702d998447 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -35,19 +35,18 @@ module ActionDispatch
def dispatcher?; @dispatcher; end
- def matches?(env)
- req = @request.new(env)
-
+ def matches?(req)
@constraints.all? do |constraint|
(constraint.respond_to?(:matches?) && constraint.matches?(req)) ||
(constraint.respond_to?(:call) && constraint.call(*constraint_args(constraint, req)))
end
- ensure
- req.reset_parameters
end
def call(env)
- matches?(env) ? @app.call(env) : [ 404, {'X-Cascade' => 'pass'}, [] ]
+ req = @request.new(env)
+ matches?(req) ? @app.call(env) : [ 404, {'X-Cascade' => 'pass'}, [] ]
+ ensure
+ req.reset_parameters
end
private
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index 5839db87f9..7a565635f5 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -704,7 +704,7 @@ module ActionDispatch
old_params = req.path_parameters
req.path_parameters = old_params.merge params
app = route.app
- if app.matches?(env) && app.dispatcher?
+ if app.matches?(req) && app.dispatcher?
dispatcher = app.app
if dispatcher.controller(params, false)