refactor(dossier_preloader): assign champ.parent

This commit is contained in:
simon lehericey 2022-10-04 17:32:45 +02:00
parent 01f6e5a06b
commit 1f95f68fcc
2 changed files with 5 additions and 1 deletions

View file

@ -80,6 +80,10 @@ class DossierPreloader
def load_champs(parent, name, champs, dossier, children_by_parent)
champs.each do |champ|
champ.association(:dossier).target = dossier
if parent.is_a?(Champ)
champ.association(:parent).target = parent
end
end
parent.association(name).target = champs.sort_by do |champ|

View file

@ -30,7 +30,7 @@ describe DossierPreloader do
expect(first_child.parent).to eq(repetition)
end
expect(count).to eq(1)
expect(count).to eq(0)
end
end
end