class ActiveModel::Validations::PostalCodeValidator
Public Class Methods
new(options)
click to toggle source
Calls superclass method
# File lib/postjoy/validator.rb, line 5 def initialize(options) options.reverse_merge!(message: "is invalid") super(options) end
Public Instance Methods
validate_each(record, attribute, value)
click to toggle source
# File lib/postjoy/validator.rb, line 10 def validate_each(record, attribute, value) if !Postjoy.find(value) record.errors.add(attribute, options.fetch(:message), value: value) end end