diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2014-05-27 14:46:49 -0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2014-05-27 14:46:49 -0300 |
commit | 6f9aff75a5e8cdfb92e425e433807ac2972df740 (patch) | |
tree | 359a3ed6f85116835e17d1cc51f10b3495eb6de2 /actionpack/lib/action_dispatch/journey | |
parent | 0bef6ff9af6be8d0def825a09188697526f7dae2 (diff) | |
parent | 15df2a3c796832224c3d98091321895aa2641157 (diff) | |
download | rails-6f9aff75a5e8cdfb92e425e433807ac2972df740.tar.gz rails-6f9aff75a5e8cdfb92e425e433807ac2972df740.tar.bz2 rails-6f9aff75a5e8cdfb92e425e433807ac2972df740.zip |
Merge pull request #15321 from tgxworld/only_find_routes_as_heads_for_head_request
Call get_routes_as_head only on HEAD requests.
Diffstat (limited to 'actionpack/lib/action_dispatch/journey')
-rw-r--r-- | actionpack/lib/action_dispatch/journey/router.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/journey/router.rb b/actionpack/lib/action_dispatch/journey/router.rb index c0317e3ad2..7e525d04d4 100644 --- a/actionpack/lib/action_dispatch/journey/router.rb +++ b/actionpack/lib/action_dispatch/journey/router.rb @@ -99,7 +99,10 @@ module ActionDispatch routes = filter_routes(req.path_info).concat custom_routes.find_all { |r| r.path.match(req.path_info) } - routes.concat get_routes_as_head(routes) + + if req.env["REQUEST_METHOD"] === "HEAD" + routes.concat get_routes_as_head(routes) + end routes.sort_by!(&:precedence).select! { |r| r.matches?(req) } |