From 710c5eaf2f7766885d7c8f448de8b3b3ff8929f6 Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Mon, 25 Jul 2011 11:37:25 -0700 Subject: 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. --- actionpack/lib/action_dispatch/routing/mapper.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'actionpack/lib/action_dispatch') 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 -- cgit v1.2.3