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

namespace in routes changes both the path and name prefix.

This commit is contained in:
José Valim 2010-01-06 09:51:46 +01:00
parent e4099c2ad3
commit 0d5ce7c525
2 changed files with 5 additions and 2 deletions

View file

@ -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 = {})

View file

@ -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