Added failing tests for saving embedded records #578

wants to merge 2 commits into from

5 participants


Creating a new record and adding a new embedded record will result in two requests (embedded: 'always'):

  • One POST request for the parent with the child record embedded
  • One POST request for child record

The second request is not necessary, because the child is embedded in the first request.

Creating a new embedded record on an existing parent results in a POST request to the childs url. My understanding is that it should perform a PUT request to the parents' url with the child embedded.


I can confirm this exact problem.

@NilsLattek have you found a workaround?


Not yet. It might be possible to solve this using the new dirtyRecordsForHasManyChange methods. I am guessing that there is still some work going on for embedded records.


I have the exact same problem.
It seems to me that dirtyRecordsForHasManyChange can't solve the problem.
The problem is that the new embedded object is already in dirty state right after its creation with createRecord().
I can't find a way to remove it from its dirty state.

There is also a question on SO:


@bobey I think a newly created record (embedded or not) should be in a dirty state. I think the real problem here is that persistence is handled by separately for each record, instead of through the parent.

  • For an existing parent record and a new embedded record, saving should result in a PUT for the parent record (with the embedded record inside it).
  • When both the parent and embedded child are new, a single POST for the parent should occur.

In both cases, persistence is handled through the parent.

That said, I don't know exactly how to fix this, my understanding of the inner workings of ember data isn't deep enough.


@sandstrom I just tested this one and it fixes the bug:


The first problem was fixed in: 3b91851

Ember.js member

Seems to be fixed.

@igorT igorT closed this Apr 6, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment