aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2011-03-30 20:56:05 -0500
committerJoshua Peek <josh@joshpeek.com>2011-03-30 20:56:05 -0500
commit5df076ad0965dc684afff8a019fd9f92a53ada76 (patch)
treeb2272d3d7f0ed6713d888390a13b130c65aec6f3 /actionpack/lib/action_dispatch/routing
parentac9443ed71bf0b40cf5b321e8e1b77b98abd9b5e (diff)
parent9772de8d459960cc114c5b214343b7ce08fea21c (diff)
downloadrails-5df076ad0965dc684afff8a019fd9f92a53ada76.tar.gz
rails-5df076ad0965dc684afff8a019fd9f92a53ada76.tar.bz2
rails-5df076ad0965dc684afff8a019fd9f92a53ada76.zip
Merge branch 'master' into sprockets
Diffstat (limited to 'actionpack/lib/action_dispatch/routing')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index cc6b8aa82d..14c424f24b 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -107,7 +107,7 @@ module ActionDispatch
if @options[:format] == false
@options.delete(:format)
path
- elsif path.include?(":format") || path.end_with?('/')
+ elsif path.include?(":format") || path.end_with?('/') || path.match(/^\/?\*/)
path
else
"#{path}(.:format)"
@@ -364,6 +364,13 @@ module ActionDispatch
# match 'path' => 'c#a', :defaults => { :format => 'jpg' }
#
# See <tt>Scoping#defaults</tt> for its scope equivalent.
+ #
+ # [:anchor]
+ # Boolean to anchor a #match pattern. Default is true. When set to
+ # false, the pattern matches any request prefixed with the given path.
+ #
+ # # Matches any request starting with 'path'
+ # match 'path' => 'c#a', :anchor => false
def match(path, options=nil)
mapping = Mapping.new(@set, @scope, path, options || {})
app, conditions, requirements, defaults, as, anchor = mapping.to_route