From ad311f215da43c6ddac5697ff37e1b93dbcbedcb Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 14 Aug 2015 10:09:09 -0700 Subject: remove hard coded regular expression --- actionpack/lib/action_dispatch/journey/route.rb | 4 ++++ actionpack/lib/action_dispatch/journey/router.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_dispatch/journey/route.rb b/actionpack/lib/action_dispatch/journey/route.rb index cbc985640a..1ead6c8a82 100644 --- a/actionpack/lib/action_dispatch/journey/route.rb +++ b/actionpack/lib/action_dispatch/journey/route.rb @@ -112,6 +112,10 @@ module ActionDispatch constraints[:ip] || // end + def requires_matching_verb? + constraints[:request_method] + end + def verb constraints[:request_method] || // end diff --git a/actionpack/lib/action_dispatch/journey/router.rb b/actionpack/lib/action_dispatch/journey/router.rb index 31b6731a67..543ffc144e 100644 --- a/actionpack/lib/action_dispatch/journey/router.rb +++ b/actionpack/lib/action_dispatch/journey/router.rb @@ -120,7 +120,7 @@ module ActionDispatch end def match_head_routes(routes, req) - verb_specific_routes = routes.reject { |route| route.verb == // } + verb_specific_routes = routes.select(&:requires_matching_verb?) head_routes = match_routes(verb_specific_routes, req) if head_routes.empty? -- cgit v1.2.3