Method: PartitionalValidator#validate_each
- Defined in:
- lib/partitional/validator.rb
#validate_each(record, attribute, value) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/partitional/validator.rb', line 21 def validate_each(record, attribute, value) return if [:if].present? && !to_value(record, [:if]) return if [:unless].present? && to_value(record, [:unless]) value.validate mapping = value.mapping value.errors.each do |error| record.errors.add(mapping[error.attribute], error.) end end |