Class: ActiveModel::Validations::ExistenceValidator

Inherits:
PresenceValidator
  • Object
show all
Defined in:
lib/can_has_validations/validators/existence_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object



7
8
9
10
11
12
# File 'lib/can_has_validations/validators/existence_validator.rb', line 7

def validate(record)
  attributes.each do |attribute|
    value = record.read_attribute_for_validation(attribute)
    validate_each(record, attribute, value)
  end
end