diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 9c14305ba9..3e577c7f99 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -292,7 +292,7 @@ module ActionDispatch end def namespace(path) - scope("/#{path}") { yield } + scope("/#{path}", :name_prefix => path.to_s) { yield } end def constraints(constraints = {}) diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index a746c7e2ed..32e2717789 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -66,7 +66,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest resources :people do nested do - namespace ":access_token" do + scope "/:access_token" do resource :avatar end end @@ -433,12 +433,15 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest with_test_routes do get '/account/subscription' assert_equal 'subscriptions#show', @response.body + assert_equal '/account/subscription', account_subscription_path get '/account/credit' assert_equal 'credits#show', @response.body + assert_equal '/account/credit', account_credit_path get '/account/credit_card' assert_equal 'credit_cards#show', @response.body + assert_equal '/account/credit_card', account_credit_card_path end end