Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #21 from nilbus/fetch-add

Compile javascript
  • Loading branch information...
commit 21a52f60ee45f4d41357828df585c35792e8072d 2 parents 1565445 + 6347832
@lucian1900 lucian1900 authored
Showing with 9 additions and 3 deletions.
  1. +9 −3 backbone.dualstorage.js
View
12 backbone.dualstorage.js
@@ -183,8 +183,12 @@
case 'clear':
return store.clear();
case 'create':
- model = store.create(model);
- if (options.dirty) return store.dirty(model);
+ if (!(options.add && !options.merge && store.find(model))) {
+ model = store.create(model);
+ if (options.dirty) {
+ return store.dirty(model);
+ }
+ }
break;
case 'update':
store.update(model);
@@ -262,7 +266,9 @@
var i, _i, _len;
console.log('got remote', resp, 'putting into', options.storeName);
resp = parseRemoteResponse(model, resp);
- localsync('clear', model, options);
+ if (!options.add) {
+ localsync('clear', model, options);
+ }
if (_.isArray(resp)) {
for (_i = 0, _len = resp.length; _i < _len; _i++) {
i = resp[_i];
Please sign in to comment.
Something went wrong with that request. Please try again.