models: validate that no drop-downs are empty on publishing
Disallow publishing a procedure containing drop-downs with no selectable values.
This commit is contained in:
parent
e219ec33d8
commit
b7d17b0989
5 changed files with 51 additions and 4 deletions
|
@ -234,7 +234,10 @@ 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, 'revisions/no_empty_repetition': true, if: :validate_for_publication?
|
||||
validates :draft_revision,
|
||||
'revisions/no_empty_repetition': true,
|
||||
'revisions/no_empty_drop_down': true,
|
||||
if: :validate_for_publication?
|
||||
validate :check_juridique
|
||||
validates :path, presence: true, format: { with: /\A[a-z0-9_\-]{3,200}\z/ }, uniqueness: { scope: [:path, :closed_at, :hidden_at, :unpublished_at], case_sensitive: false }
|
||||
validates :duree_conservation_dossiers_dans_ds, allow_nil: false, numericality: { only_integer: true, greater_than_or_equal_to: 1, less_than_or_equal_to: MAX_DUREE_CONSERVATION }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue