Class: EacRailsUtils::NoPresenceValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
app/validators/eac_rails_utils/no_presence_validator.rb

Overview

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, _value) ⇒ Object



6
7
8
9
10
# File 'app/validators/eac_rails_utils/no_presence_validator.rb', line 6

def validate_each(record, attribute, _value)
  return if record.send(attribute).blank?

  record.errors[attribute] << (options[:message] || 'must be blank')
end