1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Ensure match path, :controller => name works as expected.

This commit is contained in:
José Valim 2010-04-12 16:49:41 +02:00
parent ccf33660a1
commit a8b1ca26d7
2 changed files with 13 additions and 2 deletions

View file

@ -124,11 +124,13 @@ module ActionDispatch
controller, action = to.split('#')
{ :controller => controller, :action => action }
when Symbol
{ :action => to.to_s }.merge(default_controller ? { :controller => default_controller } : {})
{ :action => to.to_s }
else
default_controller ? { :controller => default_controller } : {}
{}
end
defaults[:controller] ||= @options[:controller] || default_controller
if defaults[:controller].blank? && segment_keys.exclude?("controller")
raise ArgumentError, "missing :controller"
end

View file

@ -52,6 +52,8 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
match 'global/:action'
end
match "/local/:action", :controller => "local"
constraints(:ip => /192\.168\.1\.\d\d\d/) do
get 'admin' => "queenbee#index"
end
@ -415,6 +417,13 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
def test_local
with_test_routes do
get '/local/dashboard'
assert_equal 'local#dashboard', @response.body
end
end
def test_projects
with_test_routes do
get '/projects'