Backbone.js 主干集合.where错误

Backbone.js 主干集合.where错误,backbone.js,coffeescript,underscore.js,Backbone.js,Coffeescript,Underscore.js,我认为我在做一些愚蠢的、明显错误的事情,但我感到困惑。使用CoffeeScript和木偶主干,我想在我的集合中创建一个方法,将大多数模型设置为selected,然后将all selected设置为unselected。我猜想 deselectAll: -> @where({selected: true}) 我将得到所选的模型,我可以迭代(对于所选的模型)并设置模型。但我无法找到“去哪里工作”,而是得到: Uncaught TypeError: _.matches is not a f

我认为我在做一些愚蠢的、明显错误的事情,但我感到困惑。使用CoffeeScript和木偶主干,我想在我的集合中创建一个方法,将大多数模型设置为selected,然后将all selected设置为unselected。我猜想

deselectAll: ->
  @where({selected: true})
我将得到所选的模型,我可以迭代(对于所选的模型)并设置模型。但我无法找到“去哪里工作”,而是得到:

Uncaught TypeError: _.matches is not a function
从主干:

where: function(attrs, first) {
  var matches = _.matches(attrs);
  return this[first ? 'find' : 'filter'](function(model) {
    return matches(model.attributes);
  });
},
更新

它当前正在使用过滤器:

@filter (model) ->
  model.get 'selected'
它似乎比where更复杂,但也许不是?

backbone=1.8.0
。将主干升级到1.2.2或1.2.3


下划线
1.8.0中,函数
匹配
已被弃用并重命名为
matcher
。看

啊!好发现。非常感谢。我知道这很简单+只要我的代表足够高,我就为链接添加1