Skip to content

Commit

Permalink
reuse this.related if its already a Backbone.Collection
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Henry committed Jun 21, 2011
1 parent 40d9ac8 commit 06f59ae
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions backbone-relational.js
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,10 @@
this.related.unbind( 'add', this.handleAddition ).unbind('remove', this.handleRemoval );
this.related = attr;
this.related.bind( 'add', this.handleAddition ).bind( 'remove', this.handleRemoval );
}
else {
} else if( this.related instanceof Backbone.Collection ) {
this.setRelated( this.related );
this.findRelated();
} else {
this.setRelated( this.getNewCollection() );
this.findRelated();
}
Expand Down

0 comments on commit 06f59ae

Please sign in to comment.