Sha256: b50d0117c141562157abe6399989c97b772145ac28bd3d995d94df00f6012468
Contents?: true
Size: 385 Bytes
Versions: 3
Compression:
Stored size: 385 Bytes
Contents
class SsnValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) unless valid_ssn?(record, attribute, value) record.errors[attribute] << "#{value} is not a valid Social Security Number" end end def self.kind :custom end def valid_ssn?(_record, _attribute, _value) # irrelevant here how validation is done true end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mongoid-rspec-4.1.0 | spec/validators/ssn_validator.rb |
mongoid-rspec-4.0.1 | spec/validators/ssn_validator.rb |
mongoid-rspec-4.0.0 | spec/validators/ssn_validator.rb |