Class: ActiveModel::Validations::AbsenceValidator

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

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



4
5
6
# File 'lib/active_model/validations/absence_validator.rb', line 4

def validate_each(record, attribute, value)  
  record.errors.add(attribute, options[:message] || :absence) unless value.blank?
end