From 3613f6e22f06509e93a49ec0f600d9d09eca05f4 Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Mon, 15 Apr 2013 16:05:17 -0700 Subject: [PATCH] Set up the connected handler before connect --- lib/model.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/model.js b/lib/model.js index d0cded0a..622f8246 100644 --- a/lib/model.js +++ b/lib/model.js @@ -258,13 +258,12 @@ AbstractClass.create = function (data, callback) { function stillConnecting(schema, obj, args) { if (schema.connected) return false; - if (!schema.connecting) { - schema.connect(); - } + if (schema.connecting) return true; var method = args.callee; schema.on('connected', function () { method.apply(obj, [].slice.call(args)); }); + schema.connect(); return true; };