Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't remove new objects from collections.

  • Loading branch information...
commit 3dd50142950f5e64193071d206279ea16adc3154 1 parent 41a0d85
@thomasst thomasst authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 backbone-relational.js
View
6 backbone-relational.js
@@ -893,8 +893,10 @@
if ( coll instanceof Backbone.Collection ) {
// Make sure to operate on a copy since we're removing while iterating
_.each( coll.models.slice(0) , function( model ) {
- oldIds[ model.id ] = true;
- coll.remove( model, { silent: (model.id in newIds) } );
+ if ( !model.isNew() ) {
+ oldIds[ model.id ] = true;
+ coll.remove( model, { silent: (model.id in newIds) } );
+ }
});
} else {
coll = this._prepareCollection();
Please sign in to comment.
Something went wrong with that request. Please try again.