models: refactor the types_de_champ validators

Context: we want to validate public and private types_de_champ
separately.

Before we validated the whole revision (and then validators themselves
enumerated all champs, public and private).

Now we validate the actual public types_de_champ, which will let us
validate separately the private types_de_champ.
This commit is contained in:
Pierre de La Morinerie 2022-01-26 16:52:32 +00:00
parent 64d75360d0
commit e8e37cce15
8 changed files with 22 additions and 30 deletions

View file

@ -245,7 +245,7 @@ class Procedure < ApplicationRecord
validates :description, presence: true, allow_blank: false, allow_nil: false
validates :administrateurs, presence: true
validates :lien_site_web, presence: true, if: :publiee?
validates :draft_revision,
validates :draft_types_de_champ,
'revisions/no_empty_repetition': true,
'revisions/no_empty_drop_down': true,
if: :validate_for_publication?