From db8289a19da25df4d1b4b7495de2a3ece665d055 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Wed, 23 Jan 2019 16:13:38 +0100 Subject: [PATCH] procedure: ensure a procedure can't be deleted while it has dossiers --- app/models/procedure.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/procedure.rb b/app/models/procedure.rb index 276a90183..9b0eeb631 100644 --- a/app/models/procedure.rb +++ b/app/models/procedure.rb @@ -6,7 +6,7 @@ class Procedure < ApplicationRecord has_many :types_de_piece_justificative, -> { ordered }, dependent: :destroy has_many :types_de_champ, -> { root.public_only.ordered }, dependent: :destroy has_many :types_de_champ_private, -> { root.private_only.ordered }, class_name: 'TypeDeChamp', dependent: :destroy - has_many :dossiers + has_many :dossiers, dependent: :restrict_with_exception has_many :deleted_dossiers, dependent: :destroy has_one :module_api_carto, dependent: :destroy