Class: Shamu::Attributes::Validators::ValidValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/shamu/attributes/validators/valid_validator.rb

Overview

Validates that an attribute's value returns true for valid?.

validates :nested_request, valid: true

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



8
9
10
# File 'lib/shamu/attributes/validators/valid_validator.rb', line 8

def validate_each( record, attribute, value )
  record.errors.add attribute, :invalid if value && !value.valid?
end