Sha256: 84ed7c58f21e9d6314391a7a0e484539c07c7d1cef61ea7c45d03a0824faeebd

Contents?: true

Size: 274 Bytes

Versions: 2

Compression:

Stored size: 274 Bytes

Contents

require "active_model"
require "validates_telephone/telephone"

class TelephoneValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    record.errors[attribute] << I18n.t("errors.messages.invalid") unless Telephone.new(value).valid?
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
validates_telephone-0.1.0 lib/validates_telephone.rb
validates_telephone-0.0.1 lib/validates_telephone.rb