Class: ParanoidStarlight::Validators::TelephoneValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/paranoid_starlight/validators.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/paranoid_starlight/validators.rb', line 28

def validate_each(record, attribute, value)
  # SK/CZ format
  valid = ::ParanoidStarlight::Converters.telephone_will_convert?(value) 
  unless valid
    record.errors[attribute] << (options[:message] || 'is not a telephone number')
  end
end