ensure a dossier_id is set if possible

This commit is contained in:
clemkeirua 2020-09-30 15:56:06 +02:00
parent 5e081dd85b
commit 9019a8b380

View file

@ -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] }