diff --git a/app/models/validations/property_validations.rb b/app/models/validations/property_validations.rb index 121dc2cd0..8ed0afcde 100644 --- a/app/models/validations/property_validations.rb +++ b/app/models/validations/property_validations.rb @@ -84,7 +84,7 @@ module Validations::PropertyValidations else record.errors.add :startdate, I18n.t("validations.lettings.property.startdate.postcode_not_in_england") end - elsif record.is_supported_housing? # TODO: revisit + elsif record.is_supported_housing? && !record.read_attribute(:la) # `!record.read_attribute(:la)` being satisfied means the address questions (including LA) haven't been answered and the LA is coming from location. record.errors.add :location_id, I18n.t("validations.lettings.property.location_id.not_in_england") record.errors.add :scheme_id, I18n.t("validations.lettings.property.scheme_id.not_in_england") record.errors.add :startdate, I18n.t("validations.lettings.property.startdate.location_not_in_england") @@ -109,7 +109,7 @@ module Validations::PropertyValidations record.errors.add :uprn, I18n.t("validations.lettings.property.uprn.la_not_valid_for_date", la: la.name) record.errors.add :uprn_selection, I18n.t("validations.lettings.property.uprn_selection.la_not_valid_for_date", la: la.name) record.errors.add :startdate, I18n.t("validations.lettings.property.startdate.la_not_valid_for_date", la: la.name) - elsif record.is_supported_housing? # TODO: revisit + elsif record.is_supported_housing? && !record.read_attribute(:la) # `!record.read_attribute(:la)` being satisfied means the address questions (including LA) haven't been answered and the LA is coming from location. record.errors.add :location_id, I18n.t("validations.lettings.property.location_id.la_not_valid_for_date", la: la.name) record.errors.add :scheme_id, I18n.t("validations.lettings.property.scheme_id.la_not_valid_for_date", la: la.name) record.errors.add :startdate, I18n.t("validations.lettings.property.startdate.la_not_valid_for_date", la: la.name)