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.
10 lines
421 B
10 lines
421 B
3 years ago
|
module Validations::PropertyValidations
|
||
3 years ago
|
# Validations methods need to be called 'validate_<page_name>' to run on model save
|
||
|
# or 'validate_' to run on submit as well
|
||
3 years ago
|
def validate_property_number_of_times_relet(record)
|
||
3 years ago
|
if record.offered && !/^[1-9]$|^0[1-9]$|^1[0-9]$|^20$/.match?(record.offered.to_s)
|
||
|
record.errors.add :offered, "Property number of times relet must be between 0 and 20"
|
||
3 years ago
|
end
|
||
|
end
|
||
|
end
|