lib/vindetta/validator.rb in vindetta-0.7.0 vs lib/vindetta/validator.rb in vindetta-0.8.0
- old
+ new
@@ -1,17 +1,17 @@
-require 'active_model'
+require "active_model"
module Vindetta
class Validator < ActiveModel::Validator
LENGTH = 17
def self.run(value)
Vin.new(value).valid?
end
def validate(record)
- if record.value.length != LENGTH
- record.errors.add(:value, "Invalid Length") # TODO: Move to I18n
- end
+ record.errors.add(:value, I18n.t("invalid_length")) if record.value.length != LENGTH
+
+ # TODO: Check format
end
end
end