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
var newChild = store.createRecord('childModel', data);
store.save();
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')
})
Aucun commentaire:
Enregistrer un commentaire