diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-30 14:24:22 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-06-03 11:33:53 -0700 |
commit | 981029b3ffdeaae8d70640cbf1bd4884eca7e51b (patch) | |
tree | f7bc0c210190074a0c4031564c74cfb500d0a33d | |
parent | 404feeb2e486597215f28d3922a65d443c643e6e (diff) | |
download | rails-981029b3ffdeaae8d70640cbf1bd4884eca7e51b.tar.gz rails-981029b3ffdeaae8d70640cbf1bd4884eca7e51b.tar.bz2 rails-981029b3ffdeaae8d70640cbf1bd4884eca7e51b.zip |
only do Regexp === option once
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 7 |
1 files 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 |