Class: Eac::NoPresenceValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/eac/no_presence_validator.rb

Overview

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, _value) ⇒ Object



7
8
9
10
# File 'lib/eac/no_presence_validator.rb', line 7

def validate_each(record, attribute, _value)
  return if record.send(attribute).blank?
  record.errors[attribute] << (options[:message] || 'must be blank')
end