Sha256: 0643c2aae530dea785317e55f483942715a72c80545fc2e90a2c2009087b968f
Contents?: true
Size: 260 Bytes
Versions: 3
Compression:
Stored size: 260 Bytes
Contents
class PhoneValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) return if value.blank? unless value.to_s.gsub(/[\s-]+/, '').length >= 10 record.errors.add attribute, :must_have_at_least_10_digits end end end
Version data entries
3 entries across 3 versions & 1 rubygems