Sha256: 23e017cb04a5405b1990c4e9e56350e864eeec469ce5cdb6cbfe48be0709b686
Contents?: true
Size: 418 Bytes
Versions: 3
Compression:
Stored size: 418 Bytes
Contents
## # Validates that the given string has the correct rut syntax class RutValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) if value.nil? || !value.is_a?(String) record.errors.add attribute, (options[:message] || "is a empty rut") elsif !Chilean::Rutify.valid_rut?(value) record.errors.add attribute, (options[:message] || "is not a valid rut") end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
chilean-rutify-0.1.3 | lib/chilean/rutify/rut_validator.rb |
chilean-rutify-0.1.2 | lib/chilean/rutify/rut_validator.rb |
chilean-rutify-0.1.1 | lib/chilean/rutify/rut_validator.rb |