forbid to create champ with same type_de_champ and same row

This commit is contained in:
Christophe Robillard 2020-04-02 20:17:26 +02:00
parent 0538da3fad
commit 5b6044803b
2 changed files with 12 additions and 0 deletions

View file

@ -21,6 +21,8 @@ class Champ < ApplicationRecord
before_create :set_dossier_id, if: :needs_dossier_id?
validates :type_de_champ_id, uniqueness: { scope: [:dossier_id, :row] }
def public?
!private?
end