emberjs/data — pull request #440 by pivotal-medici (2012-10-26 20:53:26+00:00)
Title: Allow parent and child records to be saved in the same commit

Currently (as of 4c47535) you can't create a new parent and child record in the same commit (see #437).

We're hoping to use this pull request as the start of a conversation about how best to fix this issue. We've added a failing integration test for the interaction between the store and REST adapter.

The current error is:

```
could not respond to event didChangeData in state rootState.loaded.created.inFlight
```

This happens because the store, upon receiving a call to `didSaveRecord`, assumes the parent is in the `loaded.saved` state. It's not, however, because it still has a dirty factor for its has-many relationship.

--

_NB:_ We're stubbing XMLHttpRequest with sinon.js, which ensures that the test runs through the entire Ember Data stack. We'd like to see this pattern—of pushing integration test stubs to the layer just below Ember Data—spread throughout the suite.