PaulUithol/Backbone-relational — Issue #64: Cleanup after saving new model
Author: pgherveou
Created: 2012-01-21 10:28:14+00:00
State: open

Hello Paul, one issue I ran into lately :
When you save a new model with nested relation, and get the model back from the server with an id set on both parent and children model, the original children are replaced with the one returned by the server but are not removed from the store.
Is there a way to avoid that, or automate the clean up ?
I use something like that to remove this models from the store after a save

```javascript
clean: function(Model) {
return this.store.getCollection(Model).each(function(m) {
if (m.isNew()) m.destroy();
});
```