Class: ActiveModel::Validations::PhoneFormatValidator

Inherits:
EachValidator
  • Object
show all
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, **options.merge({:value => value})) if value.to_s !~ ValidatesPhoneFormatOf::Regexp
end