diff --git a/packages/strapi-bookshelf/lib/index.js b/packages/strapi-bookshelf/lib/index.js index cb40bb2d97..cc27ec2fe4 100755 --- a/packages/strapi-bookshelf/lib/index.js +++ b/packages/strapi-bookshelf/lib/index.js @@ -487,17 +487,38 @@ module.exports = function(strapi) { }); if (manyRelations && manyRelations.dominant) { + const collection = manyRelations.plugin ? + strapi.plugins[manyRelations.plugin].models[manyRelations.collection]: + strapi.models[manyRelations.collection]; + const attributes = { [`${pluralize.singular(manyRelations.collection)}_id`]: { type: 'integer' }, - [`${pluralize.singular(manyRelations.via)}_id`]: { + [`${pluralize.singular(definition.globalId.toLowerCase())}_id`]: { type: 'integer' } }; - const keys = [pluralize.plural(manyRelations.collection), pluralize.plural(manyRelations.via)]; - const table = [keys.join('_'), keys.reverse().join('_')].join('__'); + const table = _.get(manyRelations, 'collectionName') || + _.map( + _.sortBy( + [ + collection.attributes[ + manyRelations.via + ], + manyRelations + ], + 'collection' + ), + table => { + return _.snakeCase( + pluralize.plural(table.collection) + + ' ' + + pluralize.plural(table.via) + ); + } + ).join('__'); await handler(table, attributes); } diff --git a/packages/strapi-plugin-content-manager/config/layout.json b/packages/strapi-plugin-content-manager/config/layout.json index 284b0cb7ae..9e26dfeeb6 100644 --- a/packages/strapi-plugin-content-manager/config/layout.json +++ b/packages/strapi-plugin-content-manager/config/layout.json @@ -1,9 +1 @@ -{ - "article": { - "attributes": { - "title": { - "appearance": "" - } - } - } -} \ No newline at end of file +{} \ No newline at end of file