From 0d5ce7c52555c859ca5d6fb10abb4f6424d785c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 6 Jan 2010 09:51:46 +0100 Subject: [PATCH] namespace in routes changes both the path and name prefix. --- actionpack/lib/action_dispatch/routing/mapper.rb | 2 +- actionpack/test/dispatch/routing_test.rb | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) 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