procedure: ensure a procedure can't be deleted while it has dossiers

This commit is contained in:
Pierre de La Morinerie 2019-01-23 16:13:38 +01:00
parent fb75461c78
commit db8289a19d

View file

@ -6,7 +6,7 @@ class Procedure < ApplicationRecord
has_many :types_de_piece_justificative, -> { ordered }, dependent: :destroy 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, -> { root.public_only.ordered }, dependent: :destroy
has_many :types_de_champ_private, -> { root.private_only.ordered }, class_name: 'TypeDeChamp', 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_many :deleted_dossiers, dependent: :destroy
has_one :module_api_carto, dependent: :destroy has_one :module_api_carto, dependent: :destroy