Sha256: c04eea44c2c978c94353c8e7f66cdf63bb1b3fce1f80a8b1a97b22ca03c3a538
Contents?: true
Size: 904 Bytes
Versions: 1
Compression:
Stored size: 904 Bytes
Contents
require 'polish_validators_rails/version' require 'polish_validators' require 'active_record' class NipValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) validator = ::PolishValidators::NipValidator.new(value) record.errors.add(attribute, @options[:message] || 'Invalid NIP format') unless validator.valid? end end class PeselValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) validator = ::PolishValidators::PeselValidator.new(value) record.errors.add(attribute, @options[:message] || 'Invalid PESEL format') unless validator.valid? end end class RegonValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) validator = ::PolishValidators::RegonValidator.new(value) record.errors.add(attribute, @options[:message] || 'Invalid REGON format') unless validator.valid? end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
polish_validators_rails-1.0.0 | lib/polish_validators_rails.rb |