Sha256: dc550a7787ca1d823668fbe396269529f19b81b5db8aac9985cac253bfb5476a
Contents?: true
Size: 254 Bytes
Versions: 4
Compression:
Stored size: 254 Bytes
Contents
class ZipcodeValidator < ActiveModel::EachValidator def validate_each(object, attribute, value) unless value =~ /^\A[\d]{5}(?:[-|\s][\d]{4})?\Z$/ object.errors[attribute] << (options[:message] || "is not formatted properly") end end end
Version data entries
4 entries across 4 versions & 1 rubygems