mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +02:00
parent
7530dd7b62
commit
3de5a0b51b
2 changed files with 13 additions and 11 deletions
|
@ -1,10 +1,12 @@
|
|||
class E164Validator < ActiveModel::EachValidator
|
||||
def validate_each(record, attribute, _value)
|
||||
validator = ActiveModel::Validations::LengthValidator.new(maximum: 17, attributes: attribute)
|
||||
validator.validate(record)
|
||||
length_validator = ActiveModel::Validations::
|
||||
LengthValidator.new(maximum: 17, attributes: attribute)
|
||||
length_validator.validate(record)
|
||||
|
||||
validator = ActiveModel::Validations::FormatValidator.new(with: /\+[0-9]{1,3}\.[0-9]{1,14}?/,
|
||||
attributes: attribute)
|
||||
validator.validate(record)
|
||||
format_validator = ActiveModel::Validations::
|
||||
FormatValidator.new(with: /\+[0-9]{1,3}\.[0-9]{1,14}?/,
|
||||
attributes: attribute)
|
||||
format_validator.validate(record)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue