From 981029b3ffdeaae8d70640cbf1bd4884eca7e51b Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 30 May 2014 14:24:22 -0700 Subject: only do Regexp === option once --- actionpack/lib/action_dispatch/routing/mapper.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 5182d9e8e1..b54367eceb 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -305,9 +305,10 @@ module ActionDispatch def constraints(option_constraints, constraints, path_params) required_defaults = [] options.each_pair do |key, option| - constraints[key] = option if Regexp === option - unless path_params.include?(key) || Regexp === option - required_defaults << key + if Regexp === option + constraints[key] = option + else + required_defaults << key unless path_params.include?(key) end end @conditions[:required_defaults] = required_defaults -- cgit v1.2.3