Embedded data results in an additional request with faulty url #516

NilsLattek opened this Issue Dec 12, 2012 · 7 comments

5 participants


When accessing a URL which includes the ID of a specific model and this model has embedded records. Ember also tries to create an additional request for the embedded data, but with a wrong ID.
Sourcecode: http://jsfiddle.net/BgwM8/7/

Checkout the following demo using these steps:
1) Open a new tab and open the chrome dev tools
2) Navigate to: http://fiddle.jshell.net/BgwM8/7/show/#/clients
3) Everything is fine and ember tries to load the data from the following url: "/clients"
4) Now click on "My Client"
5) You will see the detail page of the client and the url changes to "clients/1". The name and the embedded tag are visible.
6) Now reload the page at this url
7) Ember tries to load the data from "/clients/1" which returns a client with an embedded tag. BUT ember also starts a request to "/tags". Which is wrong because the tag data is embedded inside the client.
When I am running this example on my local machine using a real backend server and not a mocked ajax method as in the fiddle, it shows me the url it tries to access: http://localhost:4567/tags?ids%5B%5D=%5Bobject+Object%5D
Somehow it tries to interpret the embedded object as an embedded id.

Ember.js member

+1, I'm having the same exact issue


I have updated the example to use the latest ember + data versions (after the embedded-data merge): http://jsfiddle.net/BgwM8/16/

It now generates the following error on the detail page: Uncaught TypeError: Cannot call method 'hasOwnProperty' of undefined
Does anybody have a working "embedded" example using the new router syntax?


@NilsLattek I'm having the same problem. It appears the hash being passed to DS.JSONSerializer#extractId is undefined.

I've traced it back to clientID returning undefined here:

I'm not sure if that's expected behavior or not though.


It looks like this got fixed with the latest update a72ed12
Loading embedded records works now.

@NilsLattek NilsLattek closed this Jan 4, 2013

I still get the following error "Uncaught TypeError: Cannot call method 'hasOwnProperty' of undefined " on embedded records. Did you make it works ?


I can confirm, it's still an issue. @ThomasDurin


Yes it's working for me, I have uploaded a complete example here (using latest master): https://www.dropbox.com/s/80r6z63g4ljnt7q/ember-data-example.zip
This uses a sinatra server as a demo backend, I had some problems with the ajax mocking stuff in jsfiddle...
However I am still not using embedded records, because of some other problems: #578

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment