class MongoModel::Validations::AssociatedValidator

Public Instance Methods

validate_each(record, attribute, value) click to toggle source
# File lib/mongomodel/concerns/validations/associated.rb, line 4
def validate_each(record, attribute, value)
  return if Array(value).map { |r| r.nil? || r.valid?(record.validation_context) }.all?
  record.errors.add(attribute, :invalid, options.merge(:value => value))
end