Filter Association
ebasley opened this issue · comments
ebasley commented
we can define a filter witin an association at definition time like :
patio.addModel("father").oneToMany("children", {query : {age : {gt : 10}}})
but how can we do it when we use it, ex:
var Father = patio.addModel("father").oneToMany("children")
Father.first().then(function(f){
f.children.filter( {age : {gt : 10} }).then ....
});
this means association call should be able to return a query rather than a promise
Doug Martin commented
Every association added to a model will have a {{associationName}}Dataset
property added to it.
f.childrenDataset.filter({age : {gt : 10}}).then()
Hope this helps!