Skip to content

Commit 8e7f468

Browse files
committed
refactor: 404・500・422 エラーページのルーティングを一元化
1 parent 092c3dd commit 8e7f468

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

config/routes.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@
107107
mount LetterOpenerWeb::Engine, at: "/letter_opener" if Rails.env.development?
108108
mount Rambulance::Engine => "/"
109109

110+
Rails.application.routes.draw do
111+
%w(404 500 422).each do |code|
112+
match code, to: "errors#show", via: :all, defaults: { status_code: code }
113+
end
114+
110115
if Rails.env.development? || Rails.env.test?
111116
get "/trigger_500", to: ->(env) { raise "Triggering 500 error" }
112117
get "/trigger_422", to: "errors#unprocessable_entity"

0 commit comments

Comments
 (0)