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

Commit 2bbf6397 by Mick Hansen

Merge pull request #2485 from overlookmotel/bug-fix-quote

Fix(queryGenerator#quote): `as` variable
2 parents 943b55b3 e6525223
Showing with 8 additions and 5 deletions
......@@ -536,24 +536,27 @@ module.exports = (function() {
// (checking associations to see if names should be singularised or not)
var tableNames = []
, parentAssociation
, len = obj.length;
, len = obj.length
, item
, model
, as
, association;
for (var i = 0; i < len - 1; i++) {
var item = obj[i];
item = obj[i];
if (item._modelAttribute || Utils._.isString(item) || item._isSequelizeMethod || 'raw' in item) {
break;
}
var model, as;
if (item instanceof Model) {
model = item;
as = undefined;
} else {
model = item.model;
as = item.as;
}
// check if model provided is through table
var association;
if (!as && parentAssociation && parentAssociation.through.model === model) {
if (!as && parentAssociation && parentAssociation.through && parentAssociation.through.model === model) {
association = {as: Utils.singularize(model.tableName, model.options.language)};
} else {
// find applicable association for linking parent to this model
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!