|
|
@ -8,4 +8,12 @@ module Validations::SalesValidations |
|
|
|
record.errors.add :beds, "Number of bedrooms must be between 1 and 9" |
|
|
|
record.errors.add :beds, "Number of bedrooms must be between 1 and 9" |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def validate_beds_proptype(record) |
|
|
|
|
|
|
|
# Integer(record.offered_before_type_cast) |
|
|
|
|
|
|
|
if record.beds.present? && record.beds.to_i != 1 && record.proptype == 2 |
|
|
|
|
|
|
|
record.errors.add :beds, "A bedsit can not have more than 1 bedroom" |
|
|
|
|
|
|
|
record.errors.add :proptype, "A bedsit can not have more than 1 bedroom" |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|