Class: RutValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- RutValidator
- Defined in:
- lib/validator.rb
Overview
Validates if the given string has the correct rut/run syntax and if the rut/run has the correct digit.
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
8 9 10 11 12 |
# File 'lib/validator.rb', line 8 def validate_each(record, attribute, value) unless value.rut_valid? record.errors[attribute] << ([:message] || "is not a valid rut") end end |