Submit social housing lettings and sales data (CORE)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

8 lines
391 B

module PropertyValidations
# Validations methods need to be called 'validate_' to run on model save
def validate_property_number_of_times_relet(record)
if record.property_number_of_times_relet && !/^[1-9]$|^0[1-9]$|^1[0-9]$|^20$/.match?(record.property_number_of_times_relet.to_s)
record.errors.add :property_number_of_times_relet, "Must be between 0 and 20"
end
end
end