Skip to content

Instantly share code, notes, and snippets.

@craigmaslowski
Created February 10, 2012 22:26
Show Gist options
  • Save craigmaslowski/1793576 to your computer and use it in GitHub Desktop.
Save craigmaslowski/1793576 to your computer and use it in GitHub Desktop.
Compound Id's with Backbone
parse: function (respo) {
respo.compoundId = respo.id + '::' + respo.type;
return respo;
},
sync: function (method, model, options) {
if (model.attributes.compoundId) {
model.id = model.get('id');
delete model.attributes.compoundId;
}
Backbone.sync(method, model, options);
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment