aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-01-06 09:51:46 +0100
committerJosé Valim <jose.valim@gmail.com>2010-01-06 09:51:46 +0100
commit0d5ce7c52555c859ca5d6fb10abb4f6424d785c7 (patch)
treece9901581a0654b6889b612ae1e58c8f14bbc5e0 /actionpack
parente4099c2ad3aa82061c8766dc3781fcd2923289e5 (diff)
downloadrails-0d5ce7c52555c859ca5d6fb10abb4f6424d785c7.tar.gz
rails-0d5ce7c52555c859ca5d6fb10abb4f6424d785c7.tar.bz2
rails-0d5ce7c52555c859ca5d6fb10abb4f6424d785c7.zip
namespace in routes changes both the path and name prefix.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb2
-rw-r--r--actionpack/test/dispatch/routing_test.rb5
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