mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Fix how routes inside namespaces are generated.
This commit is contained in:
@@ -726,7 +726,7 @@ module ActionDispatch
|
||||
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])
|
||||
|
||||
@@ -660,7 +660,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
|
||||
|
||||
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 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
|
||||
|
||||
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 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user