superfeedr / indexeddb-backbonejs-adapter

An indexedDB adapter for Backbonejs
http://blog.superfeedr.com/indexeddb-backbonejs-adapter/
MIT License
248 stars 61 forks source link

using model.isAttribute instead of id #49

Closed harshals closed 10 years ago

harshals commented 10 years ago

modified the library a bit to use idAttribute instead of json.id .

julien51 commented 10 years ago

What's the reason behind using idAttribute rather than id?

harshals commented 10 years ago

helps when your models are using idAttribute other than id. eg. "_id" . http://backbonejs.org/#Model-idAttribute . I am trying to synchronise between an offline indexed-db and online MongoDB data. hence the "_id".

julien51 commented 10 years ago

@harshals Sorry for the delay. This seems quite a specific problem. It would help if other people reported that need?

julien51 commented 10 years ago

Please, help me understand why this behavior applies to more than just your mongo use case? It seems that it affects everyone just for your single use case? I'm more than happy to reopen if needed.

aevare commented 10 years ago

I have not tried the changes submitted here, but there should be a check for idAttribute. Backbone supports it for a reason: http://backbonejs.org/#Model-idAttribute I am currently syncing from a server that uses "schemaId" instead of "id". But every time i pull from the server, the adapter creates a new model instead of updating the previous one.