Class: Viitenumero::ViiteValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/viitenumero/viite_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



3
4
5
# File 'lib/viitenumero/viite_validator.rb', line 3

def validate_each(record, attribute, value)
  record.errors[attribute] << (options[:message] || 'on virheellinen') unless Viite.valid?(value)
end