Class: Crm::Helpers::Validators::CrmListValidator

Inherits:
CrmEachValidator
  • Object
show all
Defined in:
lib/crm/helpers/validators/crm_list_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/crm/helpers/validators/crm_list_validator.rb', line 7

def validate_each(record, attribute, value)
  return if value.is_a?(Array)

  record.errors.add(
    attribute,
    I18n.t('activerecord.errors.messages.not_a_list')
  )
end