Procedure: save procedure while cloning

This is required to be able to assign the administrateur.instructeur to the defaut_groupe_instructeur of the new procedure
This commit is contained in:
simon lehericey 2019-08-21 16:33:26 +02:00
parent a2061fba79
commit a82d49aa60
2 changed files with 4 additions and 4 deletions

View file

@ -136,9 +136,7 @@ class Admin::ProceduresController < AdminController
render '/admin/procedures/transfer', formats: 'js', status: 404
else
procedure = current_administrateur.procedures.find(params[:procedure_id])
clone_procedure = procedure.clone(admin, false)
clone_procedure.save
procedure.clone(admin, false)
flash.now.notice = "La démarche a correctement été clonée vers le nouvel administrateur."
@ -162,7 +160,7 @@ class Admin::ProceduresController < AdminController
procedure = Procedure.find(params[:procedure_id])
new_procedure = procedure.clone(current_administrateur, cloned_from_library?)
if new_procedure.save
if new_procedure.valid?
flash.notice = 'Démarche clonée'
redirect_to edit_admin_procedure_path(id: new_procedure.id)
else

View file

@ -247,6 +247,8 @@ class Procedure < ApplicationRecord
procedure.service = self.service.clone_and_assign_to_administrateur(admin)
end
procedure.save
admin.instructeur.assign_to_procedure(procedure)
procedure