diff options
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 8 | ||||
-rw-r--r-- | actionpack/test/dispatch/routing_test.rb | 15 |
2 files changed, 23 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 6db8d1aacc..0f267caefe 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -679,6 +679,14 @@ module ActionDispatch end end + def namespace(path) + if @scope[:scope_level] == :resources + nested { super } + else + super + end + end + def match(*args) options = args.extract_options! diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 5c46f9b971..c4e402afd3 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -144,6 +144,12 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest resources :sheep + resources :clients do + namespace :google do + resource :account + end + end + match 'sprockets.js' => ::TestRoutingMapper::SprocketsApp match 'people/:id/update', :to => 'people#update', :as => :update_person @@ -813,6 +819,15 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest assert_equal '/account/admin/subscription', account_admin_subscription_path end end + + def test_namespace_nested_in_resources + with_test_routes do + get '/clients/1/google/account' + assert_equal '/clients/1/google/account', client_google_account_path(1) + + assert_equal 'google/accounts#show', @response.body + end + end def test_articles_with_id with_test_routes do |