未验证 提交 ff2fe014 编写于 作者: R Rafael Mendonça França

Merge pull request #27089 from erickueen/erickueen_fix_26606

Fix incorrect output from rails routes when using singular resources …
* Fixes multiple calls to `logger.fatal` instead of a single call, * Fixes incorrect output from rails routes when using singular resources.
for every line in an exception backtrace, when printing trace
Fixes #26606.
*Erick Reyna*
* Fixes multiple calls to `logger.fatal` instead of a single call,
for every line in an exception backtrace, when printing trace
from `DebugExceptions` middleware. from `DebugExceptions` middleware.
Fixes #26134 Fixes #26134.
*Vipul A M* *Vipul A M*
* Add support for arbitrary hashes in strong parameters: * Add support for arbitrary hashes in strong parameters:
```ruby ```ruby
......
...@@ -1244,11 +1244,11 @@ def resources_path_names(options) ...@@ -1244,11 +1244,11 @@ def resources_path_names(options)
# the plural): # the plural):
# #
# GET /profile/new # GET /profile/new
# POST /profile
# GET /profile # GET /profile
# GET /profile/edit # GET /profile/edit
# PATCH/PUT /profile # PATCH/PUT /profile
# DELETE /profile # DELETE /profile
# POST /profile
# #
# === Options # === Options
# Takes same options as +resources+. # Takes same options as +resources+.
...@@ -1266,15 +1266,15 @@ def resource(*resources, &block) ...@@ -1266,15 +1266,15 @@ def resource(*resources, &block)
concerns(options[:concerns]) if options[:concerns] concerns(options[:concerns]) if options[:concerns]
collection do
post :create
end if parent_resource.actions.include?(:create)
new do new do
get :new get :new
end if parent_resource.actions.include?(:new) end if parent_resource.actions.include?(:new)
set_member_mappings_for_resource set_member_mappings_for_resource
collection do
post :create
end if parent_resource.actions.include?(:create)
end end
end end
......
...@@ -159,13 +159,13 @@ def test_rails_routes_with_namespaced_controller_environment ...@@ -159,13 +159,13 @@ def test_rails_routes_with_namespaced_controller_environment
end end
RUBY RUBY
expected_output = [" Prefix Verb URI Pattern Controller#Action", expected_output = [" Prefix Verb URI Pattern Controller#Action",
" admin_post POST /admin/post(.:format) admin/posts#create",
" new_admin_post GET /admin/post/new(.:format) admin/posts#new", " new_admin_post GET /admin/post/new(.:format) admin/posts#new",
"edit_admin_post GET /admin/post/edit(.:format) admin/posts#edit", "edit_admin_post GET /admin/post/edit(.:format) admin/posts#edit",
" GET /admin/post(.:format) admin/posts#show", " admin_post GET /admin/post(.:format) admin/posts#show",
" PATCH /admin/post(.:format) admin/posts#update", " PATCH /admin/post(.:format) admin/posts#update",
" PUT /admin/post(.:format) admin/posts#update", " PUT /admin/post(.:format) admin/posts#update",
" DELETE /admin/post(.:format) admin/posts#destroy\n"].join("\n") " DELETE /admin/post(.:format) admin/posts#destroy",
" POST /admin/post(.:format) admin/posts#create\n"].join("\n")
output = Dir.chdir(app_path) { `bin/rails routes -c Admin::PostController` } output = Dir.chdir(app_path) { `bin/rails routes -c Admin::PostController` }
assert_equal expected_output, output assert_equal expected_output, output
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册