Class: ActiveModel::Validations::PhoneFormatValidator
- Inherits:
-
EachValidator
- Object
- EachValidator
- ActiveModel::Validations::PhoneFormatValidator
- Defined in:
- lib/validates_phone_format_of.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
10 11 12 |
# File 'lib/validates_phone_format_of.rb', line 10 def validate_each(record, attribute, value) record.errors.add(attribute, :invalid_phone, **.merge({:value => value})) if value.to_s !~ ValidatesPhoneFormatOf::Regexp end |