refactor(dossier_preloader): assign champ.parent
This commit is contained in:
parent
01f6e5a06b
commit
1f95f68fcc
2 changed files with 5 additions and 1 deletions
|
@ -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|
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue