From 7eee177a0d859fcc0a12f688a48e2c58515b35db Mon Sep 17 00:00:00 2001 From: jojo897 Date: Thu, 5 Jan 2017 18:54:50 +0100 Subject: [PATCH] fixes waterline/issues/1427 --- lib/waterline-schema/joinTables.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/waterline-schema/joinTables.js b/lib/waterline-schema/joinTables.js index d765e37..78d5b12 100644 --- a/lib/waterline-schema/joinTables.js +++ b/lib/waterline-schema/joinTables.js @@ -496,7 +496,7 @@ JoinTables.prototype.markCustomJoinTables = function(collection) { var throughPath = collection + '.' + attribute; var linkedAttrs = this.collections[linkedCollection].attributes; this.collections[linkedCollection].throughTable[throughPath] = _.find(_.keys(linkedAttrs), function(attr){ - return linkedAttrs[attr].references === attributes[attribute].collection.toLowerCase(); + return linkedAttrs[attr].references === attributes[attribute].collection.toLowerCase() && attributes[attribute].via !== attr; }); // Build up proper reference on the attribute