aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-01-26 00:55:26 +0100
committerJosé Valim <jose.valim@gmail.com>2010-01-26 00:55:26 +0100
commit8974dac92e05dcab8ee552a5f40108c6ac25dc36 (patch)
tree809ee7a5295caa44041a59110b40b31b54d4bcfa /actionpack/lib/action_dispatch
parent5d078692453c454289823700b67e64bcd4c8de7f (diff)
downloadrails-8974dac92e05dcab8ee552a5f40108c6ac25dc36.tar.gz
rails-8974dac92e05dcab8ee552a5f40108c6ac25dc36.tar.bz2
rails-8974dac92e05dcab8ee552a5f40108c6ac25dc36.zip
Ensure root routes inside optional scopes works as expected.
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index fcbb70749f..5199984814 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -157,10 +157,11 @@ module ActionDispatch
end
# Invokes Rack::Mount::Utils.normalize path and ensure that
- # (:locale) becomes (/:locale) instead of /(:locale).
+ # (:locale) becomes (/:locale) instead of /(:locale). Except
+ # for root cases, where the latter is the correct one.
def self.normalize_path(path)
path = Rack::Mount::Utils.normalize_path(path)
- path.sub!(%r{/\(+/?:}, '(/:')
+ path.sub!(%r{/(\(+)/?:}, '\1/:') unless path =~ %r{^/\(+:.*\)$}
path
end