From 9d0c3ef421f845962aa40e3bd35345a9ff213520 Mon Sep 17 00:00:00 2001 From: Sam Seed Date: Tue, 24 Jan 2023 10:34:25 +0000 Subject: [PATCH] refactor: use if rather than unless... not in property validation --- app/models/validations/sales/property_validations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/validations/sales/property_validations.rb b/app/models/validations/sales/property_validations.rb index fbe43224e..95e33148f 100644 --- a/app/models/validations/sales/property_validations.rb +++ b/app/models/validations/sales/property_validations.rb @@ -11,7 +11,7 @@ module Validations::Sales::PropertyValidations def validate_bedsit_number_of_beds(record) return if record.proptype.blank? || record.beds.blank? - unless record.proptype != 2 || record.beds <= 1 + if record.proptype == 2 && record.beds > 1 record.errors.add :proptype, I18n.t("validations.property.proptype.bedsits_have_max_one_bedroom") record.errors.add :beds, I18n.t("validations.property.beds.bedsits_have_max_one_bedroom") end