提交 af4f1a01 编写于 作者: Y Yuji Yaginuma

Do not add routes when actions are not specified

Since #30241, if namepsace is specified, routes will be generated even
if there is no actions.

However, it seems that this behavior is not intentionally added behavior.
As with 5.1, routes should not be generated if actions are not specified.

Fixes #32072.
上级 59112f23
......@@ -16,6 +16,7 @@ def create_controller_files
def add_routes
return if options[:skip_routes]
return if actions.empty?
route generate_routing_code
end
......
......@@ -109,4 +109,11 @@ def test_namespaced_routes_with_multiple_actions_are_created_in_routes
assert_match(/^ namespace :admin do\n get 'dashboard\/index'\n get 'dashboard\/show'\n end$/, route)
end
end
def test_does_not_add_routes_when_action_is_not_specified
run_generator ["admin/dashboard"]
assert_file "config/routes.rb" do |routes|
assert_no_match(/namespace :admin/, routes)
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册