From c6407d7da81844efb22c295ab7f2041211a43893 Mon Sep 17 00:00:00 2001 From: Matthew Phelan Date: Wed, 15 Dec 2021 09:20:46 +0000 Subject: [PATCH] validat unitletas --- app/models/validations/property_validations.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/models/validations/property_validations.rb b/app/models/validations/property_validations.rb index e11632544..d520b6dae 100644 --- a/app/models/validations/property_validations.rb +++ b/app/models/validations/property_validations.rb @@ -13,4 +13,10 @@ module Validations::PropertyValidations record.errors.add :la, "Local authority has to be in London" end end + + def validate_unitletas(record) + if record.unitletas.present? && (record.rsnvac == "First let of newbuild property" || record.rsnvac == "First let of conversion/rehabilitation/acquired property" || record.rsnvac == "First let of leased property") + record.errors.add :unitletas, "Can not be completed if it is the first let of the property" + end + end end