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"
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"
ifage>=16&&age<=19&&relationship=="Child - includes young adult and grown-up"&&(economic_status!="Full-time student"||economic_status!="Prefer not to say")
record.errors.add"person_#{person_num}_economic_status","If age is between 16 and 19 - tenant #{person_num} must be a full time student or prefer not to say."