Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions ghost/core/core/server/models/base/plugins/raw-knex.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const _ = require('lodash');
const debug = require('@tryghost/debug')('models:base:raw-knex');
const plugins = require('@tryghost/bookshelf-plugins');
const Promise = require('bluebird');

const schema = require('../../../data/schema');

Expand Down Expand Up @@ -166,10 +165,12 @@ module.exports = function (Bookshelf) {
})();
});

return Promise.props(props)
.then((relationsToAttach) => {
return Promise.all(Object.values(props))
Comment thread
chairulakmal marked this conversation as resolved.
.then((relationsToAttachArray) => {
debug('attach relations', modelName);

const relationsToAttach = _.zipObject(_.keys(props), relationsToAttachArray);

objects = _.map(objects, (object) => {
_.each(Object.keys(relationsToAttach), (relation) => {
if (!relationsToAttach[relation][object.id]) {
Expand Down
1 change: 0 additions & 1 deletion ghost/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@
"@tryghost/zip": "1.1.37",
"amperize": "0.6.1",
"analytics-node": "6.2.0",
"bluebird": "3.7.2",
"body-parser": "1.20.2",
"bookshelf": "1.2.0",
"bookshelf-relations": "2.6.0",
Expand Down