Sha256: 9149baaac80087efb1800298f417f212e425af8993c293df623582894a97d0d8

Contents?: true

Size: 416 Bytes

Versions: 3

Compression:

Stored size: 416 Bytes

Contents

class TelephoneValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    key = :"activerecord.errors.models.#{record.class.name.downcase}.attributes.#{attribute.to_s}.invalid"
    locale = (options[:locale] or :any)
    record.errors[attribute] << I18n.t(key, :default => :"activerecord.errors.messages.invalid") unless ValidatesTelephone::Validator.new(value, locale).valid?
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
validates_telephone-1.1.0 lib/validates_telephone/telephone_validator.rb
validates_telephone-1.0.1 lib/validates_telephone/telephone_validator.rb
validates_telephone-1.0.0 lib/validates_telephone/telephone_validator.rb