diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-11 14:46:34 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-11 14:49:19 -0700 |
commit | 0c3f8e3f0248c033119c81d4590c8de2ac46f174 (patch) | |
tree | e320a1ec550f00fc577fad4ec8eafcf3cbd4271f /actionpack/lib | |
parent | 1a830cbd830c7f80936dff7e3c8b26f60dcc371d (diff) | |
download | rails-0c3f8e3f0248c033119c81d4590c8de2ac46f174.tar.gz rails-0c3f8e3f0248c033119c81d4590c8de2ac46f174.tar.bz2 rails-0c3f8e3f0248c033119c81d4590c8de2ac46f174.zip |
pull option duping up
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 6b77912ed2..56dcd1aaa4 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -1542,7 +1542,8 @@ module ActionDispatch path_types = paths.group_by(&:class) path_types.fetch(String, []).each do |_path| - process_path(options, controller, _path, option_path || _path) + route_options = options.dup + process_path(route_options, controller, _path, option_path || _path) end path_types.fetch(Symbol, []).each do |action| @@ -1554,15 +1555,13 @@ module ActionDispatch end def process_path(options, controller, path, option_path) - route_options = options.dup - path_without_format = path.sub(/\(\.:format\)$/, '') - if using_match_shorthand?(path_without_format, route_options) - route_options[:to] ||= path_without_format.gsub(%r{^/}, "").sub(%r{/([^/]*)$}, '#\1') - route_options[:to].tr!("-", "_") + if using_match_shorthand?(path_without_format, options) + options[:to] ||= path_without_format.gsub(%r{^/}, "").sub(%r{/([^/]*)$}, '#\1') + options[:to].tr!("-", "_") end - decomposed_match(path, controller, route_options, option_path) + decomposed_match(path, controller, options, option_path) end def using_match_shorthand?(path, options) |