From 365e8db792a4ce82d1683eb05edbcc78212e38cb Mon Sep 17 00:00:00 2001 From: Ryan Lue Date: Fri, 1 Mar 2019 05:26:53 +0100 Subject: [PATCH] Knowledge Base Prep: Rescue DeleteRestrictionError with 422 Unprocessable Entity --- app/controllers/application_controller/handles_errors.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/application_controller/handles_errors.rb b/app/controllers/application_controller/handles_errors.rb index 7d631e237..060198964 100644 --- a/app/controllers/application_controller/handles_errors.rb +++ b/app/controllers/application_controller/handles_errors.rb @@ -7,6 +7,7 @@ module ApplicationController::HandlesErrors rescue_from ActiveRecord::RecordNotFound, with: :not_found rescue_from ActiveRecord::StatementInvalid, with: :unprocessable_entity rescue_from ActiveRecord::RecordInvalid, with: :unprocessable_entity + rescue_from ActiveRecord::DeleteRestrictionError, with: :unprocessable_entity rescue_from ArgumentError, with: :unprocessable_entity rescue_from Exceptions::UnprocessableEntity, with: :unprocessable_entity rescue_from Exceptions::NotAuthorized, with: :unauthorized