From 5d6d0bf1e0f6e894e26a7c33317ab83b48ff0cf6 Mon Sep 17 00:00:00 2001 From: Joao Ribeiro Date: Sun, 11 Dec 2016 16:38:15 +0000 Subject: [PATCH] fix(core): better detect hasManyThrough relation closes #1 --- include-through.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include-through.js b/include-through.js index 5c624ae..fc91ec6 100644 --- a/include-through.js +++ b/include-through.js @@ -7,7 +7,8 @@ module.exports = function(Model, options) { if (relations) { Object.keys(relations).forEach(function(targetModel) { var type = - relations[targetModel].modelThrough ? 'hasManyThrough' : relations[targetModel].type; + (relations[targetModel].modelThrough || relations[targetModel].through) ? + 'hasManyThrough' : relations[targetModel].type; if (type === 'hasManyThrough') { Model.afterRemote('prototype.__get__' + targetModel, injectIncludes);