Sha256: aecb86c69333b2dde1dbd5181742f68f584dd940df4aebb75eff577915c59810
Contents?: true
Size: 379 Bytes
Versions: 1
Compression:
Stored size: 379 Bytes
Contents
require 'active_model' class BicValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) record_error(record, attribute, value) unless value =~ regexp end private def record_error(record, attribute, value) record.errors.add(attribute, (options[:message] || :invalid_bic)) end def regexp /[A-Z]{6}[A-Z0-9]{2,}/ end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bank-validator-0.2.3 | lib/active_model/bic_validator.rb |