Class: ActiveModel::Validations::EikValidator

Inherits:
EachValidator
  • Object
show all
Defined in:
lib/eik_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



75
76
77
78
79
80
81
82
83
# File 'lib/eik_validator.rb', line 75

def validate_each(record, attribute, value)
  begin
    unless Object::EikValidator.validate(value)
      record.errors[attribute] << (options[:message] || "Invalid EIK.")
    end
  rescue
    record.errors[attribute] << (options[:message] || "Invalid EIK.")
  end
end