aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2013-03-26 12:19:46 +0100
committerYves Senn <yves.senn@gmail.com>2013-03-26 12:30:25 +0100
commit69e87f5994f74eef02fdfd7912ae81a334d74218 (patch)
tree3fbd2b9e7e9d819866b6a4cf21d27c48744ce269 /actionpack/lib/action_dispatch
parentd5f4cac68c069a3caff1712fd967ed70a4eb52da (diff)
downloadrails-69e87f5994f74eef02fdfd7912ae81a334d74218.tar.gz
rails-69e87f5994f74eef02fdfd7912ae81a334d74218.tar.bz2
rails-69e87f5994f74eef02fdfd7912ae81a334d74218.zip
routing shorthand syntax works with multiple paths
Closes #9913. We need to expand the match shorthand syntax for every path.
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index f9893f2d85..f9cdfd5cf0 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -1369,11 +1369,6 @@ module ActionDispatch
paths = [path] + rest
end
- path_without_format = path.to_s.sub(/\(\.:format\)$/, '')
- if using_match_shorthand?(path_without_format, options)
- options[:to] ||= path_without_format.gsub(%r{^/}, "").sub(%r{/([^/]*)$}, '#\1')
- end
-
options[:anchor] = true unless options.key?(:anchor)
if options[:on] && !VALID_ON_OPTIONS.include?(options[:on])
@@ -1383,6 +1378,12 @@ module ActionDispatch
paths.each do |_path|
route_options = options.dup
route_options[:path] ||= _path if _path.is_a?(String)
+
+ path_without_format = _path.to_s.sub(/\(\.:format\)$/, '')
+ if using_match_shorthand?(path_without_format, route_options)
+ route_options[:to] ||= path_without_format.gsub(%r{^/}, "").sub(%r{/([^/]*)$}, '#\1')
+ end
+
decomposed_match(_path, route_options)
end
self