Browse Source

Rubocop

pull/72/head
baarkerlounger 4 years ago
parent
commit
1864fdd3b3
  1. 6
      app/validations/household_validations.rb

6
app/validations/household_validations.rb

@ -62,13 +62,9 @@ module HouseholdValidations
record.errors.add :property_unit_type, "A bedsit can only have one bedroom" record.errors.add :property_unit_type, "A bedsit can only have one bedroom"
end end
unless record.household_number_of_other_members.nil? if !record.household_number_of_other_members.nil? && record.household_number_of_other_members.positive? && (record.property_unit_type.include?("Shared") && !record.property_number_of_bedrooms.to_i.between?(1, 7))
if record.household_number_of_other_members > 0
if record.property_unit_type.include?("Shared") && !record.property_number_of_bedrooms.to_i.between?(1, 7)
record.errors.add :property_unit_type, "A shared house must have 1 to 7 bedrooms" record.errors.add :property_unit_type, "A shared house must have 1 to 7 bedrooms"
end end
end
end
if record.property_unit_type.include?("Shared") && !record.property_number_of_bedrooms.to_i.between?(1, 3) if record.property_unit_type.include?("Shared") && !record.property_number_of_bedrooms.to_i.between?(1, 3)
record.errors.add :property_unit_type, "A shared house with less than two tenants must have 1 to 3 bedrooms" record.errors.add :property_unit_type, "A shared house with less than two tenants must have 1 to 3 bedrooms"

Loading…
Cancel
Save