Permalink
Browse files

issue #19735: Make sure statuses get cleaned up properly on collections.

  • Loading branch information...
1 parent 1aae1cb commit 40db82dbee65d308afce078ea056115874241099 John Rogelstad committed Mar 10, 2013
Showing with 5 additions and 3 deletions.
  1. +1 −1 lib/backbone-x/source/collection.js
  2. +4 −2 lib/backbone-x/source/model.js
@@ -200,7 +200,7 @@ white:true*/
i,
K = XM.Model;
for (i = 0; i < result.models.length; i += 1) {
- result.models[i].setStatus(K.READY_CLEAN);
+ result.models[i].setStatus(K.READY_CLEAN, {cascade: true});
}
return result;
},
@@ -24,9 +24,9 @@ white:true*/
// Instantiate a new model object
m = new XM.MyModel(null, {isNew: true});
</code></pre>
- To load an existing record include an id in the attributes:
+ To load an existing record use the `findOrCreate` method and include an id in the attributes:
<pre><code>
- m = new XM.MyModel({id: 1});
+ m = XM.MyModel.findOrCreate({id: 1});
m.fetch();
</code></pre>
@@ -1070,6 +1070,8 @@ white:true*/
model.setStatus(status, options);
}
});
+ } else if (attr && relation.type === Backbone.HasOne) {
+ attr.setStatus(status, options);
}
});
}

0 comments on commit 40db82d

Please sign in to comment.