Class: ActiveModel::Validations::PeselValidator

Inherits:
EachValidator
  • Object
show all
Defined in:
lib/active_model/validations/pesel_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attr_name, value) ⇒ Object



4
5
6
7
8
# File 'lib/active_model/validations/pesel_validator.rb', line 4

def validate_each(record, attr_name, value)
  unless value.blank?
    record.errors.add(attr_name, :invalid, options) unless Activepesel::Pesel.new(value).valid?
  end
end