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

Commit 2730b6c4 by Mick Hansen

Merge branch 'master' into Bugari-master

2 parents 1aa0c388 a1926bd7
...@@ -933,12 +933,12 @@ module.exports = (function() { ...@@ -933,12 +933,12 @@ module.exports = (function() {
} }
} }
} else { } else {
var left = association.associationType === 'BelongsTo' ? association.target : association.source var left = association.source
, primaryKeysLeft = left.primaryKeyAttributes , primaryKeysLeft = left.primaryKeyAttributes
, tableLeft = association.associationType === 'BelongsTo' ? as : parentTable , tableLeft = parentTable
, attrLeft = primaryKeysLeft[0] , attrLeft = association.associationType === 'BelongsTo' ? association.identifierField || association.identifier : primaryKeysLeft[0]
, tableRight = association.associationType === 'BelongsTo' ? parentTable : as , tableRight = as
, attrRight = association.identifierField || association.identifier , attrRight = association.associationType !== 'BelongsTo' ? association.identifierField || association.identifier : primaryKeysLeft[0]
, joinOn; , joinOn;
// Alias the left attribute if the left attribute is not from a subqueried main table // Alias the left attribute if the left attribute is not from a subqueried main table
...@@ -962,7 +962,6 @@ module.exports = (function() { ...@@ -962,7 +962,6 @@ module.exports = (function() {
// Right side // Right side
( (
(subQuery && !include.subQuery && include.parent.subQuery && (include.hasParentRequired || include.hasParentWhere)) && self.quoteIdentifier(tableRight + '.' + attrRight) ||
self.quoteTable(tableRight) + '.' + self.quoteIdentifier(attrRight) self.quoteTable(tableRight) + '.' + self.quoteIdentifier(attrRight)
); );
......
...@@ -1057,11 +1057,16 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -1057,11 +1057,16 @@ describe(Support.getTestDialectTeaser("Include"), function () {
// Test // Test
User.find({ User.find({
where: { username: 'John'}, where: { username: 'John'},
include: [ include: [{
{ model: Address, include: [ model: Address,
{ model: Street } required: true,
], required: true, where: { active: true } } where: {
] active: true
},
include: [{
model: Street
}]
}]
}).done(function (err, john) { }).done(function (err, john) {
expect(err).not.to.be.ok expect(err).not.to.be.ok
expect(john.Address).to.be.ok expect(john.Address).to.be.ok
...@@ -1123,7 +1128,7 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -1123,7 +1128,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
chainer.run().done(callback) chainer.run().done(callback)
}] }]
}, function (err) { }, function (err) {
expect(err).not.to.be.ok expect(err).not.to.be.ok
User.findAll({ User.findAll({
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!