lib/mongomodel/concerns/validations/associated.rb in mongomodel-0.5.5 vs lib/mongomodel/concerns/validations/associated.rb in mongomodel-0.5.6
- old
+ new
@@ -4,10 +4,10 @@
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
end
-
+
module ClassMethods
# Validates whether the associated object or objects are all valid themselves. Works with any kind of association.
#
# class Book < MongoModel::Document
# has_many :pages