class ActiveRecord::Validations::AssociatedValidator
:nodoc:
def valid_object?(record)
def valid_object?(record) (record.respond_to?(:marked_for_destruction?) && record.marked_for_destruction?) || record.valid? end
def validate_each(record, attribute, value)
def validate_each(record, attribute, value) if Array(value).reject { |r| valid_object?(r) }.any? record.errors.add(attribute, :invalid, **options.merge(value: value)) end end