diff options
author | Carl Lerche <carllerche@mac.com> | 2010-04-18 13:02:37 -0700 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2010-04-18 13:02:37 -0700 |
commit | d32a4cbaa5174cc1a73d41a73f55145251c18c84 (patch) | |
tree | 16e3ad82102aa6d290b8941dd69e27b1efaf14f6 /actionpack/lib/action_dispatch/routing/mapper.rb | |
parent | c16c248912e4ae3b6a64e6acdbf1a1e0dd2feb26 (diff) | |
parent | 8c7e8976e97d96f514e22b04fc1afb9453134076 (diff) | |
download | rails-d32a4cbaa5174cc1a73d41a73f55145251c18c84.tar.gz rails-d32a4cbaa5174cc1a73d41a73f55145251c18c84.tar.bz2 rails-d32a4cbaa5174cc1a73d41a73f55145251c18c84.zip |
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'actionpack/lib/action_dispatch/routing/mapper.rb')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 6 |
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) |