!fixup .replicate() argument handling

This commit is contained in:
Ritchie Martori 2014-04-29 20:40:00 -07:00
parent e35309ba27
commit 69cd6a836b
2 changed files with 7 additions and 6 deletions

View File

@ -32,8 +32,8 @@ function RemoteConnector(settings) {
this.url = this.protocol + '://' + this.host + ':' + this.port + this.root; this.url = this.protocol + '://' + this.host + ':' + this.port + this.root;
} }
// handle mixins here // handle mixins in the define() method
this.DataAccessObject = function() {}; var DAO = this.DataAccessObject = function() {};
} }
RemoteConnector.prototype.connect = function() { RemoteConnector.prototype.connect = function() {

View File

@ -414,11 +414,13 @@ Model.replicate = function(since, targetModel, options, callback) {
callback = lastArg; callback = lastArg;
} }
if(typeof since === 'funciton' && since.modelName) { if(typeof since === 'function' && since.modelName) {
since = -1;
targetModel = since; targetModel = since;
since = -1;
} }
options = options || {};
var sourceModel = this; var sourceModel = this;
var diff; var diff;
var updates; var updates;
@ -450,7 +452,7 @@ Model.replicate = function(since, targetModel, options, callback) {
return new Change.Conflict(sourceChange, targetChange); return new Change.Conflict(sourceChange, targetChange);
}); });
callback(null, conflicts); callback && callback(null, conflicts);
}); });
function getLocalChanges(cb) { function getLocalChanges(cb) {
@ -546,7 +548,6 @@ Model.bulkUpdate = function(updates, callback) {
// tasks.push(model.save.bind(model)); // tasks.push(model.save.bind(model));
tasks.push(function(cb) { tasks.push(function(cb) {
var model = new Model(update.data); var model = new Model(update.data);
debugger;
model.save(cb); model.save(cb);
}); });
break; break;