diff --git a/app/models/champ.rb b/app/models/champ.rb index 47bb90ba1..19e2d3987 100644 --- a/app/models/champ.rb +++ b/app/models/champ.rb @@ -61,6 +61,7 @@ class Champ < ApplicationRecord scope :root, -> { where(parent_id: nil) } + before_create :set_dossier_id, if: :needs_dossier_id? before_validation :set_dossier_id, if: :needs_dossier_id? validates :type_de_champ_id, uniqueness: { scope: [:dossier_id, :row] }