Skip to content

Commit

Permalink
Merge pull request #1097 from strapi/fix/many-to-one
Browse files Browse the repository at this point in the history
Avoid to loose relationship when editing from the many side
  • Loading branch information
lauriejim committed May 3, 2018
2 parents 750167a + c67e2ef commit 67a96da
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -177,7 +177,7 @@ module.exports = {

virtualFields.push(strapi.query(details.model || details.collection, details.plugin).addRelation({
id: value[this.primaryKey] || value.id || value._id,
values: value,
values: _.pick(value, [this.primaryKey, details.via]),
foreignKey: current
}));
});
Expand All @@ -191,7 +191,7 @@ module.exports = {

virtualFields.push(strapi.query(details.model || details.collection, details.plugin).removeRelation({
id: value[this.primaryKey] || value.id || value._id,
values: value,
values: _.pick(value, [this.primaryKey, details.via]),
foreignKey: current
}));
});
Expand Down

0 comments on commit 67a96da

Please sign in to comment.