Avoid to loose relationship when editing from the many side

This commit is contained in:
Aurelsicoko 2018-05-03 12:08:35 +02:00
parent 750167aad4
commit c67e2ef6d4

View File

@ -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
}));
});
@ -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
}));
});