alekseykulikov/backbone-offline

Creates duplicate records if id is string

henrydjacob opened this issue · 1 comments

Creates duplicate records if id is string. we are using id as uuid, which returned as string.

for every fetch it creates a duplicate record.

In the model, if default value for id assigned then it creates only one duplicate record

defaults:
  id: null 

using where solved my problem, is any significant of using find instead of where?

  Collection.prototype.get = function(sid) {
    return this.items.where({
      sid: sid
    });
    //return this.items.find(function(item) {
    //  return item.get('sid') === sid;
    //});
  };