From 4bf6f1268d1594c258ff6b80934365a72639b3cf Mon Sep 17 00:00:00 2001 From: fujimura Date: Fri, 18 Jun 2010 19:01:08 +0900 Subject: [PATCH] Symbol also should be used as module prefix --- actionpack/lib/action_dispatch/routing/mapper.rb | 2 +- actionpack/test/dispatch/routing_test.rb | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletions(-) diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 46304b0..ef7356b 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -871,7 +871,7 @@ module ActionDispatch def name_for_action(action) name_prefix = @scope[:name_prefix].blank? ? "" : "#{@scope[:name_prefix]}_" - shallow_prefix = @scope[:module].blank? ? "" : "#{@scope[:module].tr('/', '_')}_" + shallow_prefix = @scope[:module].blank? ? "" : "#{@scope[:module].to_s.tr('/', '_')}_" case action when :index diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index e294703..71ab4d4 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -247,6 +247,10 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest resource :token end + scope :module => :dinner do + resource :wine + end + scope :path => 'api' do resource :me match '/' => 'mes#index' @@ -1077,6 +1081,14 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end end + def test_module_scope_by_symbol + with_test_routes do + get '/wine' + assert_equal 'dinner/wines#show', @response.body + assert_equal '/wine', wine_path + end + end + def test_path_scope with_test_routes do get '/api/me' -- 1.7.0.4