Class: Corzinus::BaseValidators::HumanNameValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
app/validators/corzinus/base_validators/human_name_validator.rb

Constant Summary collapse

SUPP_SYMBOLS =
/[[:alpha:]]/

Instance Method Summary collapse

Instance Method Details

#validate_each(object, attribute, value) ⇒ Object



6
7
8
9
10
# File 'app/validators/corzinus/base_validators/human_name_validator.rb', line 6

def validate_each(object, attribute, value)
  inspection = options[:with] || :one
  return if value.blank? || value =~ send(inspection)
  object.errors.add(attribute, I18n.t('corzinus.validators.human.name.base_regexp'))
end