From 2916521da825d5a0b93eb1cb86f12946e9345e29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 24 Aug 2010 13:05:29 -0300 Subject: [PATCH] Fix how routes inside namespaces are generated. --- actionpack/lib/action_dispatch/routing/mapper.rb | 2 +- actionpack/test/dispatch/routing_test.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 76c7ec35b9..c83d714dbc 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -726,7 +726,7 @@ def match(*args) path = options.delete(:path) action = args.first - if action && action.to_s =~ /^[A-Za-z_]\w*$/ + if action.is_a?(Symbol) || (resource_method_scope? && action.to_s =~ /^[A-Za-z_]\w*$/) path = path_for_action(action, path) options[:action] ||= action options[:as] = name_for_action(action, options[:as]) diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 3f51798285..963fea01d6 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -660,7 +660,7 @@ def test_bookmarks get '/bookmark/remove' assert_equal 'bookmarks#destroy', @response.body - assert_equal '/bookmark/remove', remove_bookmark_path + assert_equal '/bookmark/remove', bookmark_remove_path end end @@ -1195,7 +1195,7 @@ def test_match_shorthand_with_no_scope def test_match_shorthand_inside_namespace with_test_routes do - assert_equal '/account/shorthand', shorthand_account_path + assert_equal '/account/shorthand', account_shorthand_path get '/account/shorthand' assert_equal 'account#shorthand', @response.body end @@ -1247,7 +1247,7 @@ def test_redirect_with_port def test_normalize_namespaced_matches with_test_routes do - assert_equal '/account/description', description_account_path + assert_equal '/account/description', account_description_path get '/account/description' assert_equal 'account#description', @response.body -- GitLab