baarkerlounger
3 years ago
7 changed files with 28 additions and 19 deletions
@ -1,8 +1,9 @@
|
||||
module PropertyValidations |
||||
# Validations methods need to be called 'validate_' to run on model save |
||||
# Validations methods need to be called 'validate_<page_name>' to run on model save |
||||
# or 'validate_' to run on submit as well |
||||
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" |
||||
record.errors.add :property_number_of_times_relet, "Property number of times relet must be between 0 and 20" |
||||
end |
||||
end |
||||
end |
||||
|
Loading…
Reference in new issue