Fix missing dossier_id on champs inside repetition

This commit is contained in:
Paul Chavard 2019-04-18 16:55:35 +02:00
parent 7face5e971
commit 8d093bd9ba
4 changed files with 34 additions and 10 deletions

View file

@ -1,6 +1,4 @@
class Champs::RepetitionChamp < Champ
before_save :setup_dossier
has_many :champs, -> { ordered }, foreign_key: :parent_id, dependent: :destroy
accepts_nested_attributes_for :champs, allow_destroy: true
@ -22,12 +20,4 @@ class Champs::RepetitionChamp < Champ
def search_terms
# The user cannot enter any information here so it doesnt make much sense to search
end
private
def setup_dossier
champs.each do |champ|
champ.dossier = dossier
end
end
end