!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;
}
// handle mixins here
this.DataAccessObject = function() {};
// handle mixins in the define() method
var DAO = this.DataAccessObject = function() {};
}
RemoteConnector.prototype.connect = function() {

View File

@ -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;