emberjs/data — pull request #256 by ghempton (2012-05-15 08:38:37+00:00)
Title: Fix all the things...

This is an attempt at making things tenable for common transactional scenarios. This PR supersedes #253, #252, #248 as well as a fix for #254.

Specifically, the following scenarios were previously broken, but are now fixed:

1. **Modifying the parent and deleting a child.** Logic was added inside `Model.dataDidChange` to check if the association data is stale and contains deleted records.

1. **New parent-child hierarchies.** Pending records are handled inside `Model.dataDidChange`.

1. **Records can be added and deleted in Many Arrays.** This previously worked only for record arrays returned by `Store.findAll`. All many arrays are now properly tracked by the store.

1. **Embedded associations now work.** Some special handling was needed inside `Model.dataDidChange`

1. **Modifying the parent and adding a child.** For now, newly added child records will be put into the pending state *even if the parent already has an id*. This forces the child record to wait for the parent to be updated. Not ideal, but it works without ambiguity.

P.S. Sorry about the large number of commits. I can rebase into a single commit if the powers that be so desire.