Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

When resetting the subset, repopulate with filtered models from the p…

…arent.

All models in the subset should be the same instance as in the parent
collection. Corrected test to reflect this.
  • Loading branch information...
commit ed282a9882f1b84e5f3b697c8b227f96e60a0f43 1 parent 77f88d7
@saimonmoore saimonmoore authored
Showing with 5 additions and 3 deletions.
  1. +4 −2 backbone.subset.js
  2. +1 −1  test/test.js
View
6 backbone.subset.js
@@ -74,8 +74,10 @@
this.each(this._unbindModelEvents);
this._reset();
- _.each(models, function (model) {
- this._addToSubset(model, {silent: true});
+ this.parent().each(function (model) {
+ if (this.sieve(model)) {
+ this._addToSubset(model, {silent: true});
+ }
}, this);
if (!options.silent) {
View
2  test/test.js
@@ -190,6 +190,6 @@ describe('Aggregated collections', function () {
assert.deepEqual(tasks.pluck('id'), [0, 4, 5]);
assert.deepEqual(archived_tasks.pluck('id'), [5]);
assert.deepEqual(_.pluck(tasks.models, 'cid'), ['c6', 'c8', 'c9']);
- assert.deepEqual(_.pluck(archived_tasks.models, 'cid'), ['c11']);
+ assert.deepEqual(_.pluck(archived_tasks.models, 'cid'), ['c9']);
});
});
Please sign in to comment.
Something went wrong with that request. Please try again.