1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

remove hard coded regular expression

This commit is contained in:
Aaron Patterson 2015-08-14 10:09:09 -07:00
parent c3284e2a36
commit ad311f215d
2 changed files with 5 additions and 1 deletions

View file

@ -112,6 +112,10 @@ module ActionDispatch
constraints[:ip] || //
end
def requires_matching_verb?
constraints[:request_method]
end
def verb
constraints[:request_method] || //
end

View file

@ -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?