Class: PeselValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/magick_numbers_rails/pesel_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



6
7
8
# File 'lib/magick_numbers_rails/pesel_validator.rb', line 6

def validate_each(record, attribute, value)
  record.errors[attribute] << "invalid format" unless MagickNumbers::Pesel.new(value).valid?
end