Skip to content

Commit

Permalink
Merge pull request #69 from treelinehq/deep-fix
Browse files Browse the repository at this point in the history
Deep fix
  • Loading branch information
particlebanana committed Feb 17, 2017
2 parents e8ace37 + 87c3963 commit 69cd8ff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/joins/query-cache.js
Expand Up @@ -88,6 +88,7 @@ module.exports = function queryCache() {
parentPkAttr: val.parentPkAttr,
records: val.records || [],
keyName: val.keyName,
type: val.type,
belongsToPkValue: val.belongsToPkValue,

// Optional (only used if implementing a HAS_FK strategy)
Expand Down Expand Up @@ -218,6 +219,11 @@ module.exports = function queryCache() {
} else {
matchingParentRecord[cache.keyName] = [];
}

// Check if the value should be an array or dictionary
if (_.has(cache, 'type') && cache.type === 1) {
matchingParentRecord[cache.keyName] = _.first(cache.records) || {};
}
}
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "waterline-utils",
"version": "1.3.8",
"version": "1.3.9",
"description": "Various utilities for working with Waterline queries and adapters.",
"scripts": {
"test": "node ./node_modules/mocha/bin/mocha test/unit --recursive",
Expand Down

0 comments on commit 69cd8ff

Please sign in to comment.