fix(champ): fill stable_id and stream when cloning from old champs
This commit is contained in:
parent
4412aa7d9c
commit
a962e2d94e
1 changed files with 4 additions and 0 deletions
|
@ -226,6 +226,10 @@ class Champ < ApplicationRecord
|
|||
relationships = fork || !private? ? [:etablissement, :geo_areas] : []
|
||||
|
||||
deep_clone(only: champ_attributes + value_attributes, include: relationships, validate: !fork) do |original, kopy|
|
||||
if original.is_a?(Champ)
|
||||
kopy.write_attribute(:stable_id, original.stable_id)
|
||||
kopy.write_attribute(:stream, 'main')
|
||||
end
|
||||
ClonePiecesJustificativesService.clone_attachments(original, kopy)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue