I have a collection and I'm getting the models based on a property like this
var coll=reportWidgets.where({"is_editing":true});
I want to loop through these models and set the property is_editing to false.
How can I do this?
A different take on the problem, using _.chain and _.invoke for fun and, I hope, readability
reportWidgets.chain().filter(function(m) {
return m.get('is_editing');
}).invoke('set', 'is_editing', false);
And a demo http://jsfiddle.net/nikoshr/PMvLC/
Note that in that context using where would produce unexpected results since it would work on an array of models and not on a collection and its proxied underscore methods.