diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-27 13:51:58 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-27 13:51:58 -0700 |
commit | 9ad01d0adee69d7613214ad4104d419096877c07 (patch) | |
tree | 7b050bcf867bbd2064486ed3c8d2e51f87489494 | |
parent | 7fe14432d875fdf52fe95044a38f110582227bd3 (diff) | |
download | rails-9ad01d0adee69d7613214ad4104d419096877c07.tar.gz rails-9ad01d0adee69d7613214ad4104d419096877c07.tar.bz2 rails-9ad01d0adee69d7613214ad4104d419096877c07.zip |
call `serve` with the request on dispatchers
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index cabaa26e44..70c3b18e15 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -44,7 +44,13 @@ module ActionDispatch end def serve(req) - matches?(req) ? @app.call(req.env) : [ 404, {'X-Cascade' => 'pass'}, [] ] + return [ 404, {'X-Cascade' => 'pass'}, [] ] unless matches?(req) + + if dispatcher? + @app.serve req + else + @app.call req.env + end ensure req.reset_parameters end @@ -219,15 +225,10 @@ module ActionDispatch end def app - # Unwrap any constraints so we can see what's inside for route generation. - # This allows the formatter to skip over any mounted applications or redirects - # that shouldn't be matched when using a url_for without a route name. + return to if Redirect === to + if to.respond_to?(:call) - if Redirect === to - to - else - Constraints.new(to, blocks, false) - end + Constraints.new(to, blocks, false) else if blocks.any? Constraints.new(dispatcher, blocks, true) |