Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Delete Record, reset relations before calling the deleteRecord of the adapter #534

youknowriad opened this Issue Dec 18, 2012 · 6 comments


None yet
4 participants

Hello, I have an issue with the deleteRecord Hook because of a tricky API I have to deal with.

Let say I have a parent/child models and i want to delete a child record. The url i have to call is something like this: http://apiurl/parent/:parent_id/child/:child_id

So in the deleteRecord adapter i try to build the url using the record to delete, something like:

deleteRecord: function(store, type, record) {
   var url = 'http://apiurl/parent/' + record.get('parent.id') + '/child/' + record.get('id') 

but the problem is when the deleteRecord of the adapter is called, the record in parameter has no relations (I think they were reseted before).

Is there a way to solve this?



sly7-7 commented May 13, 2013

@youknowriad Could you please check if this is still the same behavior on master ?

I'm sorry I cant' test this quickly, I have not this use case anymore.


sly7-7 commented May 13, 2013

@youknowriad don't worry :). I just did a quick test, and indeed it appears that the relationships are cleared before the adapter method is called. I don't know if it will changed.
@stefanpenner any thoughts ?


wagenet commented Oct 13, 2013

@wycats do you think this is still an issue.


sly7-7 commented Oct 13, 2013

@wagenet I don't know if this is an issue, but this behavior is still the same in master because https://github.com/emberjs/data/blob/master/packages/ember-data/lib/system/model/states.js#L545 is called before saving the deletion. As a result I think when the promise is fullfilled, the record does not have its relationships anymore.


sly7-7 commented Oct 30, 2014

@igorT This could be closed now, actually I think this was resolved when the ssot branch was merged.

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