From a64aef01ad9aa4ea991b4de1b5df76861fbea6bb Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Fri, 9 Apr 2010 22:18:12 -0300 Subject: [PATCH] Generate with controller_namespace if we have it --- actionpack/lib/action_dispatch/routing/mapper.rb | 2 +- actionpack/test/dispatch/routing_test.rb | 13 ++----------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 925e91f..ac52e67 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -114,7 +114,7 @@ module ActionDispatch defaults = case to when String controller, action = to.split('#') - { :controller => controller, :action => action } + { :controller => @scope[:controller_namespace] ? "#{@scope[:controller_namespace]}/#{controller}" : controller, :action => action } when Symbol { :action => to.to_s }.merge(default_controller ? { :controller => default_controller } : {}) else diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 6ff478a..381da2e 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -139,7 +139,6 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end namespace :account do - match 'shorthand' match 'description', :to => "account#description", :as => "description" resource :subscription, :credit, :credit_card @@ -797,14 +796,6 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end end - def test_convention_match_inside_namespace - with_test_routes do - assert_equal '/account/shorthand', account_shorthand_path - get '/account/shorthand' - assert_equal 'account#shorthand', @response.body - end - end - def test_convention_match_nested_and_with_leading_slash with_test_routes do assert_equal '/account/nested/overview', account_nested_overview_path @@ -847,7 +838,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest assert_equal '/account/description', account_description_path get '/account/description' - assert_equal 'account#description', @response.body + assert_equal 'account/account#description', @response.body end end @@ -855,7 +846,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest with_test_routes do assert_equal '/account', account_root_path get '/account' - assert_equal 'account#index', @response.body + assert_equal 'account/account#index', @response.body end end -- 1.7.0