Class: ActiveModel::Validations::NumberPlateSgValidator

Inherits:
EachValidator
  • Object
show all
Defined in:
lib/number_plate/sg/active_model.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



4
5
6
7
8
9
# File 'lib/number_plate/sg/active_model.rb', line 4

def validate_each(record, attribute, value)

  val = ::NumberPlate.validator('SG')

  record.errors.add attribute, (options[:message] || "is not a valid number plate") unless val.is_valid?(value)
end