fix(dossier): fix apply_diff with multiple changed rows
This commit is contained in:
parent
3b9efbc5ca
commit
c417614695
2 changed files with 5 additions and 6 deletions
|
@ -153,14 +153,11 @@ module DossierCloneConcern
|
|||
|
||||
diff[:added].each { _1.update_column(:dossier_id, id) }
|
||||
|
||||
# a bit of a hack to work around unicity index
|
||||
remove_group_id = ULID.generate
|
||||
diff[:updated].each do |champ|
|
||||
champs_index.fetch(champ.public_id).update(row_id: remove_group_id)
|
||||
champs_index.fetch(champ.public_id)&.destroy!
|
||||
champ.update_column(:dossier_id, id)
|
||||
end
|
||||
|
||||
Champ.where(row_id: remove_group_id).destroy_all
|
||||
diff[:removed].each(&:destroy!)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue