class PhoneValidator

basic phone format validator

Constants

REGEXP

Public Instance Methods

validate_each(record, attribute, value) click to toggle source
# File lib/validations/phone_validator.rb, line 4
def validate_each(record, attribute, value)
  record.errors.add attribute, (options[:message] || I18n.t('rails_validation.phone.invalid')) unless value =~ REGEXP
end