Ember data: embedded records without ids ready to go
But after a bit of digging, i’ve easily found that embedded records do still want an id key to be present to work. As of my API, i have repeated data structure in different API calls, so i wanted to share the capability of a model in many context. Embedded models were great but unfortunately the problem to have an id made me unable to use them… as they are.
Digging i’ve found that modifying indeed ember-data to do what i wanted was really easy: a mixin that properly configured can make ember-data models get the id automatically client side.
This is an example in how to use it. With this post and maybe some merge request on github i’ll try to make ember-data people aware of the problem and maybe evaluate this solution.
Looks like I’m not alone in this problem. Here is a list of documents i’ve read/tried before writing my own mixin. Of course none of them worked in my case but led me the way to the code i wrote.