diff --git a/app/models/communication/website.rb b/app/models/communication/website.rb index 6139d6a521db9facdf853a0559b43c66cf94ddc7..04cd37eb01ba7fd11c58ab9dcbab5f08279f3e4b 100644 --- a/app/models/communication/website.rb +++ b/app/models/communication/website.rb @@ -59,6 +59,8 @@ class Communication::Website < ApplicationRecord foreign_key: 'communication_website_id', association_foreign_key: 'language_id' + validates :languages, length: { minimum: 1 } + scope :ordered, -> { order(:name) } scope :in_production, -> { where(in_production: true) } scope :for_search_term, -> (term) { diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index 8c279ae64115ac2e13d13e94ee05e1b873b44514..70427fee49d968c6dccc64995eb0479c3dc0df0c 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -146,6 +146,10 @@ en: attributes: sso_mapping: missing_email: doesn't handle the email + communication/website: + attributes: + languages: + too_short: must include at least one admin: communication: blocks: diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index 2e98a1652a5dc2c1e1f253cea1b0d5931db36064..1f034044e31a9239d1f0dc5e57a38046e472a29d 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -146,6 +146,10 @@ fr: attributes: sso_mapping: missing_email: ne gère pas l'adresse email + communication/website: + attributes: + languages: + too_short: doivent en comporter une minimum admin: communication: blocks: