Saving Nested Models With Ember and HATEOAS


#1

How can I achieve something like this Ember 1.10.0 with Pod structure ? I am using HATEOAS with Ember. Both the models are under my pods directory.

So I am able to load the child and parent data from the server with this sample code.

The issue I am seeing is when I try to save using store, it uses the wrong url for saving.

I expect it to use /api/parentModel/{paren_id}/childModels but instead it uses /api/childModel to save.

// uses the server url = /api/parentModel/{id}
// response : 
 {
   links : [
    child : '/api/parentModel/{paren_id}/childModels'
   ] 
 }
export default ParentModel = DS.Model.extend({
      'child' : DS.hasMany('childModel', {async: true})
})

export default ChildModel = DS.Model.extend({
      'someProperty' : DS.attr('string')
})