# File lib/mongoid/validations/associated.rb, line 29
      def validate_each(document, attribute, value)
        begin
          document.begin_validate
          valid = Array.wrap(value).collect do |doc|
            if doc.nil?
              true
            else
              doc.validated? ? true : doc.valid?
            end
          end.all?
        ensure
          document.exit_validate
        end
        document.errors.add(attribute, :invalid) unless valid
      end