models: delete AdministrateursProcedure when destroying Procedure

This commit is contained in:
Pierre de La Morinerie 2022-03-02 12:09:35 +01:00
parent c2eab85a90
commit a645c5781d

View file

@ -176,7 +176,7 @@ class Procedure < ApplicationRecord
end end
end end
has_many :administrateurs_procedures has_many :administrateurs_procedures, dependent: :delete_all
has_many :administrateurs, through: :administrateurs_procedures, after_remove: -> (procedure, _admin) { procedure.validate! } has_many :administrateurs, through: :administrateurs_procedures, after_remove: -> (procedure, _admin) { procedure.validate! }
has_many :groupe_instructeurs, dependent: :destroy has_many :groupe_instructeurs, dependent: :destroy
has_many :instructeurs, through: :groupe_instructeurs has_many :instructeurs, through: :groupe_instructeurs