Allow format to be skipped. This is used internally by mount.

This commit is contained in:
José Valim
2010-08-24 16:56:51 -03:00
parent 0d7b8f8c83
commit 3a831cb7d6
2 changed files with 6 additions and 3 deletions

View File

@@ -87,7 +87,10 @@ module ActionDispatch
@options.reverse_merge!(:controller => /.+?/)
end
if path.include?(":format")
if @options[:format] == false
@options.delete(:format)
path
elsif path.include?(":format")
path
else
"#{path}(.:format)"
@@ -244,7 +247,7 @@ module ActionDispatch
raise "A rack application must be specified" unless path
match(path, options.merge(:to => app, :anchor => false))
match(path, options.merge(:to => app, :anchor => false, :format => false))
self
end

View File

@@ -218,7 +218,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
get "thumbnail" => "avatars#thumbnail", :as => :thumbnail, :on => :member
end
resources :invoices do
get "outstanding" => "invoices#outstanding", :as => :outstanding, :on => :collection
get "outstanding" => "invoices#outstanding", :on => :collection
get "overdue", :to => :overdue, :on => :collection
get "print" => "invoices#print", :as => :print, :on => :member
post "preview" => "invoices#preview", :as => :preview, :on => :new