From b52035cce3cd822ce0402de20be3be6d7937b26a Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Tue, 15 Apr 2025 18:01:04 +0100 Subject: [PATCH] Update validation logic for change dates to handle immediate changes --- app/models/organisation_name_change.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/organisation_name_change.rb b/app/models/organisation_name_change.rb index 6ff686e1f..577ca7b8a 100644 --- a/app/models/organisation_name_change.rb +++ b/app/models/organisation_name_change.rb @@ -74,7 +74,8 @@ private return if change_date.blank? if organisation.organisation_name_changes.visible.select(&:persisted?).any? { |record| record.change_date == change_date } - errors.add(:change_date, "Start date cannot be the same as another name change.") + errors.add(:change_date, "Start date cannot be the same as another name change.") unless immediate_change + errors.add(:immediate_change, "Start date cannot be the same as another name change.") if immediate_change end end