Merge pull request #8196 from colinux/fix-dossier-clone-error

fix(clone-rescue): when record was invalid
This commit is contained in:
Colin Darie 2022-12-05 18:27:28 +01:00 committed by GitHub
commit e5bc29020e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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