fix(type de champ): do not raise error if tdc already destroyed

This commit is contained in:
Eric Leroy-Terquem 2023-05-23 15:52:51 +02:00
parent 3627d7cae1
commit 00561999ec

View file

@ -74,7 +74,7 @@ module Administrateurs
def destroy
coordinate, type_de_champ = draft.coordinate_and_tdc(params[:stable_id])
if coordinate.used_by_routing_rules?
if coordinate&.used_by_routing_rules?
errors = "« #{type_de_champ.libelle} » est utilisé pour le routage, vous ne pouvez pas le supprimer."
@morphed = [champ_component_from(coordinate, focused: false, errors:)]
flash.alert = errors