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.
12 lines
433 B
12 lines
433 B
3 years ago
|
module Validations::LocalAuthorityValidations
|
||
|
POSTCODE_REGEXP = Validations::PropertyValidations::POSTCODE_REGEXP
|
||
|
|
||
|
def validate_previous_accommodation_postcode(record)
|
||
|
postcode = record.previous_postcode
|
||
|
if postcode.present? && !postcode.match(POSTCODE_REGEXP)
|
||
|
error_message = "Enter a postcode in the correct format, for example AA1 1AA"
|
||
|
record.errors.add :previous_postcode, error_message
|
||
|
end
|
||
|
end
|
||
|
end
|