maccman/spine — Issue #150: Cannot save a Model inside an update handler
Author: markct
Created: 2011-12-01 20:54:14+00:00
State: open

This code:

```javascript
Test.one('update', function() {
TestItem.create({ name: 'Second' });
setTimeout(function() {
TestItem.create({ name: 'Third' });
}, 500);
});
Test.create({ name: 'First' });
```

With Spine.Model.Ajax, produces the following requests:

POST /api/tests {"name":"First","id":"102AFF09-9A08-458F-BEC2-DB0675FD6479"}
POST /api/testitems {"name":"Third","id":"BE6EC458-AD16-42E1-932D-7F648580D1B7"}

I would expect there to be three requests, not two.

The bigger situation is that we want to save a object and its children, all of which are new. There seems to be no straightforward, reliable way to do this with Spine, even with the relations module. Everything seems to work with Local but all sorts of weird stuff happens with Ajax. We're getting the "flat forehead phenomenon" on this one.