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

Commit b1c0c58a by Mick Hansen

chore(associations/scope): fix a few failing tests

1 parent 7c716215
......@@ -19,7 +19,7 @@ module.exports = (function() {
this.source = source;
this.target = target;
this.targetAssociation = null;
this.options = options;
this.options = options || {};
this.sequelize = source.daoFactoryManager.sequelize;
this.through = options.through;
this.scope = options.scope;
......@@ -106,9 +106,9 @@ module.exports = (function() {
// If through is not default, determine pairing by through value (model/string)
else {
paired = self.options.through === association.options.through ||
self.options.through === association.options.through.model ||
self.options.through.model === association.options.through.model ||
self.options.through.model === association.options.through;
self.options.through === (association.options.through && association.options.through.model) ||
(self.options.through && self.options.through.model) === (association.options.through && association.options.through.model) ||
(self.options.through && self.options.through.model) === association.options.through;
}
// If paired, set properties identifying both associations as double linked, and allow them to each eachtoerh
if (paired) {
......
......@@ -536,7 +536,7 @@ module.exports = (function() {
// check if model provided is through table
var association;
if (!as && parentAssociation && parentAssociation.through === model) {
if (!as && parentAssociation && 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!