不要怂,就是干,撸起袖子干!

Commit e71e5201 by mcarboni-redant Committed by luin

Added support for Model.getAssociatedModel({ through : { where : { ... } }})

1 parent ae89e846
Showing with 6 additions and 0 deletions
......@@ -445,6 +445,12 @@ BelongsToMany.prototype.injectGetter = function(obj) {
throughWhere = {};
throughWhere[association.foreignKey] = instance.get(association.source.primaryKeyAttribute);
if (options.through && options.through.where)
throughWhere = { $and : [
throughWhere,
options.through.where
]};
if (through.scope) {
_.assign(throughWhere, through.scope);
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!