aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing/mapper.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2010-04-19 05:10:55 -0700
committerXavier Noria <fxn@hashref.com>2010-04-19 05:10:55 -0700
commit792910bb69078ff1d14a6384b50e51aba2aae2dd (patch)
tree705defb52d5ac6eb903e97334de718defc7ba4e3 /actionpack/lib/action_dispatch/routing/mapper.rb
parente00c72c9718e518eb99058781f6ee71fa46b38fe (diff)
parentad4615e97896428ca140411081442f1b5e7d6089 (diff)
downloadrails-792910bb69078ff1d14a6384b50e51aba2aae2dd.tar.gz
rails-792910bb69078ff1d14a6384b50e51aba2aae2dd.tar.bz2
rails-792910bb69078ff1d14a6384b50e51aba2aae2dd.zip
Merge commit 'rails/master'
Diffstat (limited to 'actionpack/lib/action_dispatch/routing/mapper.rb')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 53585740ce..ef2826a4e8 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -66,8 +66,8 @@ module ActionDispatch
path = normalize_path(path)
if using_match_shorthand?(path, options)
- options[:to] ||= path[1..-1].sub(%r{/([^/]*)$}, '#\1')
- options[:as] ||= path[1..-1].gsub("/", "_")
+ options[:to] ||= path[1..-1].sub(%r{/([^/]*)$}, '#\1').sub(%r{\(.*\)}, '')
+ options[:as] ||= path[1..-1].gsub("/", "_").sub(%r{\(.*\)}, '')
end
[ path, options ]
@@ -80,7 +80,7 @@ module ActionDispatch
# match "account/overview"
def using_match_shorthand?(path, options)
- path && options.except(:via, :anchor, :to, :as).empty? && path =~ %r{^/[\w\/]+$}
+ path && options.except(:via, :anchor, :to, :as).empty? && path =~ %r{^/[\w+/?]+(\(.*\))*$}
end
def normalize_path(path)