class PhoneValidator
Constants
- PHONE_REG_EXP
Public Instance Methods
validate_each(record, attribute, value)
click to toggle source
# File lib/simple_phone_validation/phone_validator.rb, line 5 def validate_each(record, attribute, value) return if options[:allow_blank] && value.blank? unless value =~ PHONE_REG_EXP record.errors[attribute] << (options[:message] || I18n.t('global.errors.phone_format')) end end