ifrecord.reason_for_leaving_last_settled_home=="Do not know"&&record.benefit_cap_spare_room_subsidy!="Do not know"
record.errors.add:benefit_cap_spare_room_subsidy,"must be do not know if tenant’s main reason for leaving is do not know"
end
end
defvalidate_armed_forces_injured(record)
if(record.armed_forces=="Yes - a regular"||record.armed_forces=="Yes - a reserve")&&record.armed_forces_injured.blank?
record.errors.add:armed_forces_injured,"You must answer the armed forces injury question if the tenant has served in the armed forces"
end
if(record.armed_forces=="No"||record.armed_forces=="Prefer not to say")&&record.armed_forces_injured.present?
record.errors.add:armed_forces_injured,"You must not answer the armed forces injury question if the tenant has not served in the armed forces or prefer not to say was chosen"
record.errors.add:outstanding_amount,"You must answer the oustanding amout question if you have outstanding rent or charges."
record.errors.add:outstanding_amount,"You must answer the oustanding amout question if you have outstanding rent or charges."
@ -71,22 +30,6 @@ 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)
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"