From c644413f8a068490ddb8038441e5b59112e8294e Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 16 Jun 2025 15:44:48 +0200 Subject: [PATCH] Fix database error instead of form validation on ToS effective date conflict (#35053) --- app/models/terms_of_service.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/terms_of_service.rb b/app/models/terms_of_service.rb index f29094036..93fe4af9c 100644 --- a/app/models/terms_of_service.rb +++ b/app/models/terms_of_service.rb @@ -20,6 +20,7 @@ class TermsOfService < ApplicationRecord validates :text, presence: true validates :changelog, :effective_date, presence: true, if: -> { published? } + validates :effective_date, uniqueness: true validate :effective_date_cannot_be_in_the_past