From e67422ad7ed2645aa0f1f18ff54e762a12929dc5 Mon Sep 17 00:00:00 2001
From: Jeremy Ashkenas
@@ -1152,25 +1150,15 @@ Backbone.Model
book.save();
-book.save({
- author: "Teddy"
-});
+book.save({author: "Teddy"});
Backbone.Collection
-var Ship = Backbone.Model.extend({ - defaults: { - "name": "Black Pearl" - } -}); - -var Fleet = Backbone.Collection.extend({ - model: Ship -}); - -var pirates = new Fleet(); +var ships = new Backbone.Collection; -pirates.bind("add", function(ship) { +ships.bind("add", function(ship) { alert("Ahoy " + ship.get("name") + "!"); }); -pirates.add([ +ships.add([ {name: "Flying Dutchman"}, - {captain: "Jack Sparrow"} + {name: "Black Pearl"} ]);