Skip to content

Commit 29c6cac

Browse files
committed
fix(config): Rambulanceの例外マッピングを修正
422エラー(InvalidAuthenticityToken)が正しく処理されて いなかった問題と、サーバー起動時にクラッシュする問題を修正。 - にを追加し、 422ページが表示されるようにマッピング。 - サーバー起動時のエラーを回避するため、 全ての例外クラスを定数から文字列に変更。
1 parent f86b750 commit 29c6cac

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

config/initializers/rambulance.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@
2929
# If Rambulance receives an exception that is not listed here, it'll render
3030
# the internal server error template and return 500 as http status.
3131
config.rescue_responses = {
32-
ActionController::RoutingError => :not_found,
33-
AbstractController::ActionNotFound => :not_found,
34-
ActionController::BadRequest => :bad_request,
32+
"ActionController::RoutingError" => :not_found,
33+
"AbstractController::ActionNotFound" => :not_found,
34+
"ActionController::BadRequest" => :bad_request,
35+
"ActionController::InvalidAuthenticityToken" => :unprocessable_entity,
3536

3637
# "ActiveRecord::RecordNotUnique" => :unprocessable_entity,
3738
# "CanCan::AccessDenied" => :forbidden,

0 commit comments

Comments
 (0)