4 changed files with 11 additions and 9 deletions
@ -0,0 +1,9 @@ |
|||||||
|
module Validations::LocalAuthorityValidations |
||||||
|
def validate_previous_accommodation_postcode(record) |
||||||
|
postcode = record.ppostcode_full |
||||||
|
if record.previous_postcode_known? && (postcode.blank? || !postcode.match(POSTCODE_REGEXP)) |
||||||
|
error_message = I18n.t("validations.postcode") |
||||||
|
record.errors.add :ppostcode_full, :wrong_format, message: error_message |
||||||
|
end |
||||||
|
end |
||||||
|
end |
||||||
Loading…
Reference in new issue