From 80e1f730a264a1875e2866cdff4b70b440f36159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 24 Aug 2010 16:56:51 -0300 Subject: Allow format to be skipped. This is used internally by mount. --- actionpack/lib/action_dispatch/routing/mapper.rb | 7 +++++-- actionpack/test/dispatch/routing_test.rb | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index f3cbba243c..9aa34e7ba5 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -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 diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 92692fb131..5b2547e700 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -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 -- cgit v1.2.3