Backbone.sync mock example fix #161

Merged
merged 1 commit into from Aug 22, 2012
Jump to file
+2 −0
Split
View
@@ -942,8 +942,10 @@ var methodMap = {
In the above example if we wanted to log an event when `.sync()` was called, we could do this:
```javascript
+var id_counter = 1;
Backbone.sync = function(method, model) {
console.log("I've been passed " + method + " with " + JSON.stringify(model));
+ if(method === 'create'){ model.set('id', id_counter++); }
};
```