diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-14 10:09:09 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-14 10:39:33 -0700 |
commit | ad311f215da43c6ddac5697ff37e1b93dbcbedcb (patch) | |
tree | 2b70b38cb541a33ab2fbe695c609922b83b643d8 /actionpack/lib | |
parent | c3284e2a36e92af1a2ad3bdbc1c74523811f3ad2 (diff) | |
download | rails-ad311f215da43c6ddac5697ff37e1b93dbcbedcb.tar.gz rails-ad311f215da43c6ddac5697ff37e1b93dbcbedcb.tar.bz2 rails-ad311f215da43c6ddac5697ff37e1b93dbcbedcb.zip |
remove hard coded regular expression
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/journey/route.rb | 4 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/journey/router.rb | 2 |
2 files changed, 5 insertions, 1 deletions
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? |