Class: ActiveModel::Validations::PhoneValidator
- Inherits:
-
EachValidator
- Object
- EachValidator
- ActiveModel::Validations::PhoneValidator
- Defined in:
- lib/pathf_validator.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
22 23 24 |
# File 'lib/pathf_validator.rb', line 22 def validate_each(record, attribute, value) record.errors[attribute] << 'is not properly formatted' unless /1?\W*([2-9][0-8][0-9])\W*([2-9][0-9]{2})\W*([0-9]{4})(\se?x?t?(\d*))?/.match(value) end |