diff --git a/docs/3.0.0-beta.x/plugin-development/backend-development.md b/docs/3.0.0-beta.x/plugin-development/backend-development.md index 4e1dbafb81..8a27a4662c 100644 --- a/docs/3.0.0-beta.x/plugin-development/backend-development.md +++ b/docs/3.0.0-beta.x/plugin-development/backend-development.md @@ -21,7 +21,10 @@ To disable the prefix, add the `prefix` attribute to each concerned route, like "method": "GET", "path": "/my-plugin-route", "handler": "MyPlugin.action", - "prefix": false + "config": { + "policies": [], + "prefix": false + } } ``` diff --git a/packages/strapi-hook-bookshelf/lib/relations.js b/packages/strapi-hook-bookshelf/lib/relations.js index 07613d1cc5..6f553d2a62 100644 --- a/packages/strapi-hook-bookshelf/lib/relations.js +++ b/packages/strapi-hook-bookshelf/lib/relations.js @@ -329,22 +329,17 @@ module.exports = { {} ); + await Promise.all(relationUpdates); + delete values[this.primaryKey]; if (!_.isEmpty(values)) { - relationUpdates.push( - this.forge({ - [this.primaryKey]: getValuePrimaryKey(params, this.primaryKey), - }).save(values, { - patch: true, - }) - ); - } else { - relationUpdates.push(Promise.resolve(_.assign(response, params.values))); + await this.forge({ + [this.primaryKey]: getValuePrimaryKey(params, this.primaryKey), + }).save(values, { + patch: true, + }); } - // Update virtuals fields. - await Promise.all(relationUpdates); - return await this.forge({ [this.primaryKey]: getValuePrimaryKey(params, this.primaryKey), }).fetch({