record.errors.add:outstanding_amount,"You must not answer the oustanding amout question if you don't have outstanding rent or charges."
end
end
EMPLOYED_STATUSES=["Full-time - 30 hours or more","Part-time - Less than 30 hours"].freeze
EMPLOYED_STATUSES=["Full-time - 30 hours or more","Part-time - Less than 30 hours"].freeze
defvalidate_net_income_uc_proportion(record)
defvalidate_net_income_uc_proportion(record)
(1..8).any?do|n|
(1..8).any?do|n|
@ -80,6 +89,16 @@ class CaseLogValidator < ActiveModel::Validator
end
end
end
end
defvalidate_armed_forces_active_response(record)
ifrecord.armed_forces=="Yes - a regular"&&record.armed_forces_active.blank?
record.errors.add:armed_forces_active,"You must answer the armed forces active question if the tenant has served as a regular in the armed forces"
end
ifrecord.armed_forces!="Yes - a regular"&&record.armed_forces_active.present?
record.errors.add:armed_forces_active,"You must not answer the armed forces active question if the tenant has not served as a regular in the armed forces"
end
end
defvalidate_household_pregnancy(record)
defvalidate_household_pregnancy(record)
if(record.pregnancy=="Yes"||record.pregnancy=="Prefer not to say")&&!women_of_child_bearing_age_in_household(record)
if(record.pregnancy=="Yes"||record.pregnancy=="Prefer not to say")&&!women_of_child_bearing_age_in_household(record)
record.errors.add:pregnancy,"You must answer no as there are no female tenants aged 16-50 in the property"
record.errors.add:pregnancy,"You must answer no as there are no female tenants aged 16-50 in the property"