You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JJModels now return a Deferred object that resolves when every dependent model has finished saving (instead of when the first model finishes saving). Update README with information about dependency on jQuery and changes to save().
Copy file name to clipboardExpand all lines: README.md
+5-2Lines changed: 5 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -38,10 +38,11 @@ Backbone JJRelational has been tested with Backbone 1.0.0 and Underscore 1.5.0
38
38
<aname="installation" />
39
39
## Installation
40
40
41
-
Backbone JJRelational depends - who would have thought - on [Backbone.JS](https://github.com/documentcloud/backbone) and [Underscore.JS](https://github.com/documentcloud/underscore).
42
-
Simply include backbone.JJRelational.js right after Underscore and Backbone.
41
+
Backbone JJRelational depends - who would have thought - on [Backbone.JS](https://github.com/documentcloud/backbone), [Underscore.JS](https://github.com/documentcloud/underscore) and [jQuery](https://github.com/jquery/jquery).
42
+
Simply include backbone.JJRelational.js right after jQuery, Underscore and Backbone.
@@ -313,6 +314,8 @@ When you call `save` on a `Backbone.JJRelationalModel`, it will walk through tha
313
314
314
315
Assume that a Store `has_many` Products, and Product `has_one` Store. You call `store.save()` ... So the Store will save itself first. After this completes, the Product's `save` will be called.
315
316
317
+
The Deferred object returned by `save` won't be resolved until all of the model's dependent models have finished saving too.
318
+
316
319
It should be noted that these related models will only be saved before/after if the model `isNew()`. If these are existing models, then you should save them each yourself individually.
317
320
318
321
You should also be aware that `save` will inevitably call `set()` on the response returned from the server, and so the usual backbone set options apply. Please read the backbone docs on how to use the `add`, `remove`, and `merge` options. In some cases, you'll probably want to pass these to `save`, which will in turn pass them through to `set`.
0 commit comments