From 7a35a253a025b1426cd200becce50e6a1ab2a8c7 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 22 Nov 2022 15:14:32 +0100 Subject: [PATCH] chore(dossier): cleanup clone champ --- app/models/champ.rb | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/app/models/champ.rb b/app/models/champ.rb index 3fc3b2bb4..3918411bf 100644 --- a/app/models/champ.rb +++ b/app/models/champ.rb @@ -217,7 +217,7 @@ class Champ < ApplicationRecord end def clone(dossier:, parent: nil) - kopy = deep_clone(only: (private? ? [] : [:value, :value_json]) + [:data, :private, :row, :type, :external_id, :type_de_champ_id], + kopy = deep_clone(only: (private? ? [] : [:value, :value_json, :data, :external_id]) + [:private, :row, :type, :type_de_champ_id], include: private? ? [] : [:etablissement, :geo_areas]) kopy.dossier = dossier @@ -233,18 +233,6 @@ class Champ < ApplicationRecord kopy end - def clone_piece_justificative(kopy) - piece_justificative_file.open do |tempfile| - kopy.piece_justificative_file.attach({ - io: File.open(tempfile.path), - filename: piece_justificative_file.filename, - content_type: piece_justificative_file.content_type, - metadata: { virus_scan_result: ActiveStorage::VirusScanner::SAFE } - }) - end - rescue ActiveStorage::FileNotFoundError, ActiveStorage::IntegrityError - end - private def champs_for_condition