Class: ATDIS::Validators::ValidValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- ATDIS::Validators::ValidValidator
- Defined in:
- lib/atdis/validators.rb
Overview
This attribute itself needs to be valid
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
87 88 89 90 91 |
# File 'lib/atdis/validators.rb', line 87 def validate_each(record, attribute, value) if (value.respond_to?(:valid?) && !value.valid?) || (value && !value.respond_to?(:valid?) && !value.all?{|v| v.valid?}) record.errors.add(attribute, ErrorMessage["is not valid (see further errors for details)", nil]) end end |