我的路由器中有这段代码:
category: (id) ->
alert id
filteredProducts = new App.Collections.Products(@productsCollection.where({category_id: id}))
@productsView.renderResults(filteredProducts)
该alert id
调用正常工作(例如 app.com/categories/6 > alerts "6"),当我id
将where
函数中的 更改为实际数字时,产品集合过滤器正确如下:
filteredProducts = new App.Collections.Products(@productsCollection.where({designer_id: 6}))
但是当我设置designer_id: id
where 循环时返回一个空集合。