From 3c5808fe037e2ee6e5d876084670591c70cdbb44 Mon Sep 17 00:00:00 2001 From: Kara Diaby Date: Mon, 23 May 2022 18:57:50 +0200 Subject: [PATCH] controller --- app/controllers/administrateurs/procedures_controller.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/controllers/administrateurs/procedures_controller.rb b/app/controllers/administrateurs/procedures_controller.rb index 173f692ec..04ac60cad 100644 --- a/app/controllers/administrateurs/procedures_controller.rb +++ b/app/controllers/administrateurs/procedures_controller.rb @@ -216,9 +216,15 @@ module Administrateurs @procedure_lien_test = commencer_test_url(path: @procedure.path) @procedure.path = @procedure.suggested_path(current_administrateur) @current_administrateur = current_administrateur + @closed_procedures = current_administrateur.procedures.with_discarded.closes.map { |p| ["#{p.libelle} (#{p.id})", p.id] }.to_h end def publish + if params[:old_procedure].present? + old_procedure = current_administrateur.procedures.with_discarded.closes.find(params[:old_procedure]) + old_procedure.update!(replaced_by_procedure_id: @procedure.id) + end + @procedure.assign_attributes(publish_params) if @procedure.draft_changed?