Fix connect() related issues #270

Merged
merged 5 commits into from Apr 19, 2013
View
@@ -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 () {
+ schema.once('connected', function () {
method.apply(obj, [].slice.call(args));
});
+ schema.connect();
return true;
};
View
@@ -66,7 +66,7 @@ function Schema(name, settings) {
// Disconnected by default
this.connected = false;
- this.connecting = true;
+ this.connecting = false;

This comment has been minimized.

Show comment Hide comment
@1602

1602 Apr 16, 2013

Owner

This fix breaks everything :) Have you tried to run tests?

@1602

1602 Apr 16, 2013

Owner

This fix breaks everything :) Have you tried to run tests?

// create blank models pool
this.models = {};