Class: NipValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/valideez/nip_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



4
5
6
7
# File 'lib/valideez/nip_validator.rb', line 4

def validate_each(record, attribute, value)
  @message = options[:message] || "invalid format"
  record.errors[attribute] << @message unless Valideez::Nip.new(value).valid?
end