I’ve been trying today to set up a proper deletion which shows a flash msg pop up if the server returns an error instead of succeeding to delete the record.
It appears that ember data wipes out the record in advance and then waits for a response from the server. I was told there is a rollback in case the deletion fails and I found a stack overflow link which says that works, but when I try to use it I get “Error: Assertion Failed: calling set on destroyed object” like I’ve described in stack overflow.
I’m confused about whether the rollback works when the final save or destroyRecord is called and if not, how am I supposed to handle this situation? Reloading the record from the server like someone suggested is inconvenient, because in this case my server team hasn’t provided a way to get this record individually by id.
I discovered now that the record actually is restored currently inside the cache according to ember inspector, but the object will not reappear in the rendering of the visitors. I need some way to force it to reload into the template…