class RutValidator
Validates if the given string has the correct rut/run syntax and if the rut/run has the correct digit.
Public Instance Methods
validate_each(record, attribute, value)
click to toggle source
@param value [String] the string to be validated
# File lib/validator.rb, line 8 def validate_each(record, attribute, value) if value.nil? or not value.is_a?(String) record.errors[attribute] << (options[:message] || "is not a valid rut") elsif not value.rut_valid? record.errors[attribute] << (options[:message] || "is not a valid rut") end end