Sha256: 6fce84b466102f3e7e200ff274f0a79104159cb459f490db01457570850bbe27

Contents?: true

Size: 299 Bytes

Versions: 6

Compression:

Stored size: 299 Bytes

Contents

class ZipcodeValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    unless ValidateZipcode::Validator.new(value, options[:country]).valid?
      record.errors[attribute] << (options[:message] || I18n.t("errors.messages.this_zip_code_is_invalid"))
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
validate_zipcode-1.3.0 lib/validate_zipcode/zipcode_validator.rb
validate_zipcode-1.2.1 lib/validate_zipcode/zipcode_validator.rb
validate_zipcode-1.2.0 lib/validate_zipcode/zipcode_validator.rb
validate_zipcode-1.1.1 lib/validate_zipcode/zipcode_validator.rb
validate_zipcode-1.1.0 lib/validate_zipcode/zipcode_validator.rb
validate_zipcode-1.0.0 lib/validate_zipcode/zipcode_validator.rb