Class: ActiveModel::Datastore::NestedAttr::AssociatedValidator

Inherits:
EachValidator
  • Object
show all
Defined in:
lib/active_model/datastore/nested_attr.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



248
249
250
251
252
# File 'lib/active_model/datastore/nested_attr.rb', line 248

def validate_each(record, attribute, value)
  return unless Array(value).reject(&:valid?).any?

  record.errors.add(attribute, :invalid, **options.merge(value: value))
end