aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing
diff options
context:
space:
mode:
authorErik Michaels-Ober <sferik@gmail.com>2011-07-25 11:37:25 -0700
committerErik Michaels-Ober <sferik@gmail.com>2011-07-25 11:37:25 -0700
commitb9c91426032e110aa60fca563ab513621096289a (patch)
tree69e6c8f64d0e1dbbcc4e44abd2a284c4898afe83 /actionpack/lib/action_dispatch/routing
parent8e0061128e8946d6e6fab68c078517db668ef050 (diff)
downloadrails-b9c91426032e110aa60fca563ab513621096289a.tar.gz
rails-b9c91426032e110aa60fca563ab513621096289a.tar.bz2
rails-b9c91426032e110aa60fca563ab513621096289a.zip
Allow a route to have :format => true
When format is true, it is mandatory (as opposed to :format => false). This is currently not possible with resource routes, which automatically make format optional by default.
Diffstat (limited to 'actionpack/lib/action_dispatch/routing')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 1331f67a78..003bc1dc2c 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -119,6 +119,8 @@ module ActionDispatch
path
elsif path.include?(":format") || path.end_with?('/')
path
+ elsif @options[:format] == true
+ "#{path}.:format"
else
"#{path}(.:format)"
end