diff options
author | Guo Xiang Tan <tgx_world@hotmail.com> | 2014-05-25 13:48:30 -0700 |
---|---|---|
committer | Guo Xiang Tan <tgx_world@hotmail.com> | 2014-05-25 13:51:53 -0700 |
commit | 15df2a3c796832224c3d98091321895aa2641157 (patch) | |
tree | 3a79f438dea2fab9574d6ca05def26d38da9061b /actionpack/lib/action_dispatch/journey | |
parent | 6c30717f8c182dc05f63779b3a9a532fb9076b05 (diff) | |
download | rails-15df2a3c796832224c3d98091321895aa2641157.tar.gz rails-15df2a3c796832224c3d98091321895aa2641157.tar.bz2 rails-15df2a3c796832224c3d98091321895aa2641157.zip |
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 2ead6a4eb3..d501b4df00 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) } |