Skip to content

Commit

Permalink
updated readme for Backbone.js 0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromegn committed Oct 25, 2010
1 parent ade7523 commit b5f10eb
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,25 @@ Create your collections like so:

window.SomeCollection = Backbone.Collection.Extend({
localStore: new Store("SomeCollection"); // Unique name within your app.
localStore: new Store("SomeCollection"), // Unique name within your app.
// New since Backbone.js 0.2
// The Store provides a JSON reponse like so:
// {models: [the models], status: "success or error string"}
parse: function(resp) {
return resp.models;
},
// ... everything else is normal.
});

Add a "parse" function to your models:

// The Store provides a JSON reponse like so:
// {models: model_data, status: "success or error string"}
parse: function(resp) {
return resp.model;
}

Feel free to use Backbone as you usually would, this is a drop-in replacement.

0 comments on commit b5f10eb

Please sign in to comment.