let's say I have a ParentObject that hasMany Items. I want to implement my Cancel feature in my Add route that will rollback everything.
In a nutshell, I have :
ParentObject that IsNew and IsDirty
and potentially...
Items[] that will also be IsNew and IsDirty
So basically, I simply want to kill those within my NewController...
Here come the faulty code :
this.get("items").forEach(function(item)
{
item.deleteRecord();
});
this.get("model").rollback();
// Some redirection stuff
As simple as it may looks, it crashes...
Here's the console output for the crash
Uncaught Error: Attempted to handle event `didSetProperty` on <App.ParentObject:ember572:fixture-0> while in state root.deleted.saved. Called with {name: number, oldValue: undefined, originalValue: undefined, value: undefined}.
If someone could figure out what may be faulty and explain what I'm doing wrong, would be pretty appreciated !
EDIT **
I played around with transaction and clearing the relationships with no success...