@ -75,17 +75,17 @@ class CaseLogValidator < ActiveModel::Validator
end
defvalidate_fixed_term_tenancy(record)
if!(record.tenancy_type=="Fixed term – Secure"||record.tenancy_type=="Fixed term – Assured Shorthold Tenancy (AST)")&&record.fixed_term_tenancy.present?
record.errors.add:fixed_term_tenancy,"You must only answer the fixed term tenancy length question if the tenancy type is fixed term"
end
ifrecord.tenancy_type=="Fixed term – Assured Shorthold Tenancy (AST)"&&!record.fixed_term_tenancy.to_i.between?(2,99)
record.errors.add:fixed_term_tenancy,"Fixed term – Assured Shorthold Tenancy (AST) should be between 2 and 99 years"
end
ifrecord.tenancy_type=="Fixed term – Secure"&&(!record.fixed_term_tenancy.to_i.between?(2,99)&&record.fixed_term_tenancy.present?)
record.errors.add:fixed_term_tenancy,"Fixed term – Secure should be between 2 and 99 years or not specified"