Skip to content

Commit ff2fe01

Browse files
committed
Merge pull request rails#27089 from erickueen/erickueen_fix_26606
Fix incorrect output from rails routes when using singular resources …
2 parents 8106a17 + c79848e commit ff2fe01

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

actionpack/CHANGELOG.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
* Fixes multiple calls to `logger.fatal` instead of a single call,
2-
for every line in an exception backtrace, when printing trace
1+
* Fixes incorrect output from rails routes when using singular resources.
2+
3+
Fixes #26606.
4+
5+
*Erick Reyna*
6+
7+
* Fixes multiple calls to `logger.fatal` instead of a single call,
8+
for every line in an exception backtrace, when printing trace
39
from `DebugExceptions` middleware.
4-
5-
Fixes #26134
10+
11+
Fixes #26134.
612

713
*Vipul A M*
8-
14+
915
* Add support for arbitrary hashes in strong parameters:
1016

1117
```ruby

actionpack/lib/action_dispatch/routing/mapper.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,11 +1244,11 @@ def resources_path_names(options)
12441244
# the plural):
12451245
#
12461246
# GET /profile/new
1247-
# POST /profile
12481247
# GET /profile
12491248
# GET /profile/edit
12501249
# PATCH/PUT /profile
12511250
# DELETE /profile
1251+
# POST /profile
12521252
#
12531253
# === Options
12541254
# Takes same options as +resources+.
@@ -1266,15 +1266,15 @@ def resource(*resources, &block)
12661266

12671267
concerns(options[:concerns]) if options[:concerns]
12681268

1269-
collection do
1270-
post :create
1271-
end if parent_resource.actions.include?(:create)
1272-
12731269
new do
12741270
get :new
12751271
end if parent_resource.actions.include?(:new)
12761272

12771273
set_member_mappings_for_resource
1274+
1275+
collection do
1276+
post :create
1277+
end if parent_resource.actions.include?(:create)
12781278
end
12791279
end
12801280

railties/test/application/rake_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,13 @@ def test_rails_routes_with_namespaced_controller_environment
159159
end
160160
RUBY
161161
expected_output = [" Prefix Verb URI Pattern Controller#Action",
162-
" admin_post POST /admin/post(.:format) admin/posts#create",
163162
" new_admin_post GET /admin/post/new(.:format) admin/posts#new",
164163
"edit_admin_post GET /admin/post/edit(.:format) admin/posts#edit",
165-
" GET /admin/post(.:format) admin/posts#show",
164+
" admin_post GET /admin/post(.:format) admin/posts#show",
166165
" PATCH /admin/post(.:format) admin/posts#update",
167166
" PUT /admin/post(.:format) admin/posts#update",
168-
" DELETE /admin/post(.:format) admin/posts#destroy\n"].join("\n")
167+
" DELETE /admin/post(.:format) admin/posts#destroy",
168+
" POST /admin/post(.:format) admin/posts#create\n"].join("\n")
169169

170170
output = Dir.chdir(app_path) { `bin/rails routes -c Admin::PostController` }
171171
assert_equal expected_output, output

0 commit comments

Comments
 (0)