Skip to content

Instantly share code, notes, and snippets.

@frekw
Created October 22, 2010 14:29
Show Gist options
  • Save frekw/640630 to your computer and use it in GitHub Desktop.
Save frekw/640630 to your computer and use it in GitHub Desktop.
Backbone.sync.parsers({
MyDocumentsModel: {
url: "/documents",
parse: function(response){
return response.documents;
}
},
...
});
// actually, this would probably be a better idea so we don't get such a high level of cohesion between names and strings...
Backbone.sync.parsers[MyDocumentsModel] = {
url: "/documents",
parse: function(response){ return response.documents; }
}
Backbone.sync.parsers[MyTags] = {
url: "/documents",
parse: function(response){ return _.map(response.documents, function(d){ return d.tags }); }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment