提交 4560385f 编写于 作者: J Jan De Poorter 提交者: José Valim

Make sure namespaces are nested within resources

Signed-off-by: NJosé Valim <jose.valim@gmail.com>
上级 db23a95a
...@@ -679,6 +679,14 @@ def nested ...@@ -679,6 +679,14 @@ def nested
end end
end end
def namespace(path)
if @scope[:scope_level] == :resources
nested { super }
else
super
end
end
def match(*args) def match(*args)
options = args.extract_options! options = args.extract_options!
......
...@@ -144,6 +144,12 @@ def self.matches?(request) ...@@ -144,6 +144,12 @@ def self.matches?(request)
resources :sheep resources :sheep
resources :clients do
namespace :google do
resource :account
end
end
match 'sprockets.js' => ::TestRoutingMapper::SprocketsApp match 'sprockets.js' => ::TestRoutingMapper::SprocketsApp
match 'people/:id/update', :to => 'people#update', :as => :update_person match 'people/:id/update', :to => 'people#update', :as => :update_person
...@@ -813,6 +819,15 @@ def test_nested_namespace ...@@ -813,6 +819,15 @@ def test_nested_namespace
assert_equal '/account/admin/subscription', account_admin_subscription_path assert_equal '/account/admin/subscription', account_admin_subscription_path
end end
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 def test_articles_with_id
with_test_routes do with_test_routes do
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册