diff --git a/lib/connectors/remote.js b/lib/connectors/remote.js index 1a252e94..23f469a8 100644 --- a/lib/connectors/remote.js +++ b/lib/connectors/remote.js @@ -32,8 +32,8 @@ function RemoteConnector(settings) { this.url = this.protocol + '://' + this.host + ':' + this.port + this.root; } - // handle mixins here - this.DataAccessObject = function() {}; + // handle mixins in the define() method + var DAO = this.DataAccessObject = function() {}; } RemoteConnector.prototype.connect = function() { diff --git a/lib/models/model.js b/lib/models/model.js index 018ef3bf..8d50976f 100644 --- a/lib/models/model.js +++ b/lib/models/model.js @@ -414,11 +414,13 @@ Model.replicate = function(since, targetModel, options, callback) { callback = lastArg; } - if(typeof since === 'funciton' && since.modelName) { - since = -1; + if(typeof since === 'function' && since.modelName) { targetModel = since; + since = -1; } + options = options || {}; + var sourceModel = this; var diff; var updates; @@ -450,7 +452,7 @@ Model.replicate = function(since, targetModel, options, callback) { return new Change.Conflict(sourceChange, targetChange); }); - callback(null, conflicts); + callback && callback(null, conflicts); }); function getLocalChanges(cb) { @@ -546,7 +548,6 @@ Model.bulkUpdate = function(updates, callback) { // tasks.push(model.save.bind(model)); tasks.push(function(cb) { var model = new Model(update.data); - debugger; model.save(cb); }); break;