From ec5efd38eeb43d66b9d1c2f0487d9fc5f12260ce Mon Sep 17 00:00:00 2001 From: pabois <pierreandre.boissinot@noesya.coop> Date: Thu, 8 Dec 2022 15:43:01 +0100 Subject: [PATCH] rescue activerecord FileNotFoundError --- app/controllers/application_controller/with_errors.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/controllers/application_controller/with_errors.rb b/app/controllers/application_controller/with_errors.rb index c4ea614da..972d51d04 100644 --- a/app/controllers/application_controller/with_errors.rb +++ b/app/controllers/application_controller/with_errors.rb @@ -14,6 +14,10 @@ module ApplicationController::WithErrors render_not_found end + rescue_from ActiveRecord::ActiveStorage::FileNotFoundError do |exception| + render_not_found + end + def raise_403_unless(condition) raise CanCan::AccessDenied unless condition end -- GitLab