From a2e80cfcca2d1328e33f81358248c6d3674f24e3 Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Mon, 5 Dec 2022 18:14:31 +0100 Subject: [PATCH] fix(clone-rescue): when record was invalid --- app/controllers/users/dossiers_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/users/dossiers_controller.rb b/app/controllers/users/dossiers_controller.rb index 3703fcdb2..031f81fbc 100644 --- a/app/controllers/users/dossiers_controller.rb +++ b/app/controllers/users/dossiers_controller.rb @@ -333,8 +333,8 @@ module Users cloned_dossier = @dossier.clone flash.notice = t('users.dossiers.cloned_success') redirect_to brouillon_dossier_path(cloned_dossier) - rescue ActiveRecord::ActiveRecordError => e - flash.alert = e.errors.full_messages + rescue ActiveRecord::RecordInvalid => e + flash.alert = e.record.errors.full_messages redirect_to dossier_path(@dossier) end