Class: Vindetta::Validator
- Inherits:
-
ActiveModel::Validator
- Object
- ActiveModel::Validator
- Vindetta::Validator
- Defined in:
- lib/vindetta/validator.rb
Constant Summary collapse
- LENGTH =
17
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.run(value) ⇒ Object
7 8 9 |
# File 'lib/vindetta/validator.rb', line 7 def self.run(value) Vin.new(value).valid? end |
Instance Method Details
#validate(record) ⇒ Object
11 12 13 14 15 |
# File 'lib/vindetta/validator.rb', line 11 def validate(record) if record.value.length != LENGTH record.errors.add(:value, "Invalid Length") # TODO: Move to I18n end end |