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

Commit 63f15c3b by mcarboni-redant Committed by luin

Update belongs-to-many.js

1 parent e71e5201
Showing with 7 additions and 6 deletions
...@@ -445,16 +445,17 @@ BelongsToMany.prototype.injectGetter = function(obj) { ...@@ -445,16 +445,17 @@ BelongsToMany.prototype.injectGetter = function(obj) {
throughWhere = {}; throughWhere = {};
throughWhere[association.foreignKey] = instance.get(association.source.primaryKeyAttribute); throughWhere[association.foreignKey] = instance.get(association.source.primaryKeyAttribute);
if (options.through && options.through.where)
throughWhere = { $and : [
throughWhere,
options.through.where
]};
if (through.scope) { if (through.scope) {
_.assign(throughWhere, through.scope); _.assign(throughWhere, through.scope);
} }
//If a user pass a where on the options through options, make an "and" with the current throughWhere
if (options.through && options.through.where) {
throughWhere = {
$and: [throughWhere, options.through.where]
};
}
options.include = options.include || []; options.include = options.include || [];
options.include.push({ options.include.push({
association: association.oneFromTarget, association: association.oneFromTarget,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!