{"action":"created","issue":{"url":"https://api.github.com/repos/strapi/strapi/issues/1749","repository_url":"https://api.github.com/repos/strapi/strapi","labels_url":"https://api.github.com/repos/strapi/strapi/issues/1749/labels{/name}","comments_url":"https://api.github.com/repos/strapi/strapi/issues/1749/comments","events_url":"https://api.github.com/repos/strapi/strapi/issues/1749/events","html_url":"https://github.com/strapi/strapi/issues/1749","id":350473639,"node_id":"MDU6SXNzdWUzNTA0NzM2Mzk=","number":1749,"title":"Can't load model within content type builder - cannot read property attributes of undefined","user":{"login":"MartinMuzatko","id":2950505,"node_id":"MDQ6VXNlcjI5NTA1MDU=","avatar_url":"https://avatars0.githubusercontent.com/u/2950505?v=4","gravatar_id":"","url":"https://api.github.com/users/MartinMuzatko","html_url":"https://github.com/MartinMuzatko","followers_url":"https://api.github.com/users/MartinMuzatko/followers","following_url":"https://api.github.com/users/MartinMuzatko/following{/other_user}","gists_url":"https://api.github.com/users/MartinMuzatko/gists{/gist_id}","starred_url":"https://api.github.com/users/MartinMuzatko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MartinMuzatko/subscriptions","organizations_url":"https://api.github.com/users/MartinMuzatko/orgs","repos_url":"https://api.github.com/users/MartinMuzatko/repos","events_url":"https://api.github.com/users/MartinMuzatko/events{/privacy}","received_events_url":"https://api.github.com/users/MartinMuzatko/received_events","type":"User","site_admin":false},"labels":[{"id":758313798,"node_id":"MDU6TGFiZWw3NTgzMTM3OTg=","url":"https://api.github.com/repos/strapi/strapi/labels/type:%20help%20wanted%20%F0%9F%A4%B7%E2%80%8D%E2%99%82%EF%B8%8F","name":"type: help wanted 🤷‍♂️","color":"1ed856","default":false}],"state":"open","locked":false,"assignee":{"login":"lauriejim","id":5716596,"node_id":"MDQ6VXNlcjU3MTY1OTY=","avatar_url":"https://avatars3.githubusercontent.com/u/5716596?v=4","gravatar_id":"","url":"https://api.github.com/users/lauriejim","html_url":"https://github.com/lauriejim","followers_url":"https://api.github.com/users/lauriejim/followers","following_url":"https://api.github.com/users/lauriejim/following{/other_user}","gists_url":"https://api.github.com/users/lauriejim/gists{/gist_id}","starred_url":"https://api.github.com/users/lauriejim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lauriejim/subscriptions","organizations_url":"https://api.github.com/users/lauriejim/orgs","repos_url":"https://api.github.com/users/lauriejim/repos","events_url":"https://api.github.com/users/lauriejim/events{/privacy}","received_events_url":"https://api.github.com/users/lauriejim/received_events","type":"User","site_admin":false},"assignees":[{"login":"lauriejim","id":5716596,"node_id":"MDQ6VXNlcjU3MTY1OTY=","avatar_url":"https://avatars3.githubusercontent.com/u/5716596?v=4","gravatar_id":"","url":"https://api.github.com/users/lauriejim","html_url":"https://github.com/lauriejim","followers_url":"https://api.github.com/users/lauriejim/followers","following_url":"https://api.github.com/users/lauriejim/following{/other_user}","gists_url":"https://api.github.com/users/lauriejim/gists{/gist_id}","starred_url":"https://api.github.com/users/lauriejim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lauriejim/subscriptions","organizations_url":"https://api.github.com/users/lauriejim/orgs","repos_url":"https://api.github.com/users/lauriejim/repos","events_url":"https://api.github.com/users/lauriejim/events{/privacy}","received_events_url":"https://api.github.com/users/lauriejim/received_events","type":"User","site_admin":false}],"milestone":null,"comments":5,"created_at":"2018-08-14T15:13:08Z","updated_at":"2018-08-20T11:27:36Z","closed_at":null,"author_association":"NONE","body":"<!-- ⚠️ If you do not respect this template your issue will be closed. -->\r\n\r\n<!-- ⚠️ Before writing your issue make sure you are using:-->\r\n<!-- Node 9.x.x -->\r\n<!-- npm 5.x.x -->\r\n<!-- The latest version of Strapi. -->\r\n\r\n**Informations**\r\n- **Node.js version**: 10.8.0\r\n- **npm version**: 6.2.0\r\n- **Strapi version**:  v3.0.0-alpha.13.1\r\n- **Database**: postgres\r\n- **Operating system**: Ubuntu Linux/WSL\r\n\r\n**What is the current behavior?**\r\n\r\nWhen loading the content type builder for a model, I get the following error:\r\n\r\n```\r\n[2018-08-14T15:07:38.403Z] debug GET /content-type-builder/connections (108 ms)\r\nTypeError: Cannot read property 'attributes' of undefined\r\n    at _.forEach (~/test-strapi/plugins/content-type-builder/services/ContentTypeBuilder.js:90:130)\r\n    at ~/test-strapi/plugins/content-type-builder/node_modules/lodash/lodash.js:4925:15\r\n    at baseForOwn (~/test-strapi/plugins/content-type-builder/node_modules/lodash/lodash.js:3010:24)\r\n    at ~/test-strapi/plugins/content-type-builder/node_modules/lodash/lodash.js:4894:18\r\n    at Function.forEach (~/test-strapi/plugins/content-type-builder/node_modules/lodash/lodash.js:9342:14)\r\n    at Object.getModel (~/test-strapi/plugins/content-type-builder/services/ContentTypeBuilder.js:76:7)\r\n    at getModel (~/test-strapi/plugins/content-type-builder/controllers/ContentTypeBuilder.js:27:31)\r\n    at dispatch (/usr/lib/node_modules/strapi/node_modules/koa-router/node_modules/koa-compose/index.js:44:32)\r\n    at next (/usr/lib/node_modules/strapi/node_modules/koa-router/node_modules/koa-compose/index.js:45:18)\r\n    at dispatch (/usr/lib/node_modules/strapi/node_modules/koa-compose/index.js:42:32)\r\n    at policies.push (/usr/lib/node_modules/strapi/lib/middlewares/router/utils/routerChecker.js:59:26)\r\n    at dispatch (/usr/lib/node_modules/strapi/node_modules/koa-compose/index.js:42:32)\r\n    at module.exports (~/test-strapi/plugins/users-permissions/config/policies/permissions.js:24:20)\r\n[2018-08-14T15:07:38.452Z] debug GET /content-type-builder/models/pagemodule? (148 ms)\r\n```\r\n\r\nThen the page prompts me to create new fields, when the overview page says it already has 4 fields.\r\n\r\n**Steps to reproduce the problem**\r\n\r\nCreate a model with the following attributes:\r\n\r\n``` json\r\n{\r\n  \"connection\": \"default\",\r\n  \"collectionName\": \"pagemodules\",\r\n  \"info\": {\r\n    \"name\": \"pagemodule\",\r\n    \"description\": \"\"\r\n  },\r\n  \"options\": {\r\n    \"increments\": true,\r\n    \"timestamps\": true,\r\n    \"comment\": \"\"\r\n  },\r\n  \"attributes\": {\r\n    \"name\": {\r\n      \"type\": \"string\"\r\n    },\r\n    \"config\": {\r\n      \"type\": \"json\"\r\n    },\r\n    \"pages\": {\r\n      \"collection\": \"page\",\r\n      \"via\": \"pageModules\",\r\n      \"dominant\": true\r\n    },\r\n    \"pageModuleType\": {\r\n      \"model\": \"pageModuleType\"\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nIf required, please let me know if the other models are also required to debug this.\r\n\r\n**What is the expected behavior?**\r\n\r\nload the fields for editing\r\n\r\n**Suggested solutions**\r\n\r\nThis is the affected line of the function: `getModel` of `plugins/content-type-builder/services/ContentTypeBuilder.js`\r\n\r\n``` js\r\nparams.targetColumnName = _.get((params.plugin ? strapi.plugins[params.plugin].models : strapi.models )[params.target].attributes[params.key], 'columnName', '');\r\n```\r\n\r\nIt looks like you will always expect to have a `params.target` and that model has one.\r\nTo me, this looks like the model - when created, was misconfigured.\r\n\r\n\r\n\r\n<!-- ⚠️ Make sure to browse the opened and closed issues before submitting your issue. -->\r\n"},"comment":{"url":"https://api.github.com/repos/strapi/strapi/issues/comments/414284105","html_url":"https://github.com/strapi/strapi/issues/1749#issuecomment-414284105","issue_url":"https://api.github.com/repos/strapi/strapi/issues/1749","id":414284105,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNDI4NDEwNQ==","user":{"login":"derrickmehaffy","id":8593673,"node_id":"MDQ6VXNlcjg1OTM2NzM=","avatar_url":"https://avatars0.githubusercontent.com/u/8593673?v=4","gravatar_id":"","url":"https://api.github.com/users/derrickmehaffy","html_url":"https://github.com/derrickmehaffy","followers_url":"https://api.github.com/users/derrickmehaffy/followers","following_url":"https://api.github.com/users/derrickmehaffy/following{/other_user}","gists_url":"https://api.github.com/users/derrickmehaffy/gists{/gist_id}","starred_url":"https://api.github.com/users/derrickmehaffy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derrickmehaffy/subscriptions","organizations_url":"https://api.github.com/users/derrickmehaffy/orgs","repos_url":"https://api.github.com/users/derrickmehaffy/repos","events_url":"https://api.github.com/users/derrickmehaffy/events{/privacy}","received_events_url":"https://api.github.com/users/derrickmehaffy/received_events","type":"User","site_admin":false},"created_at":"2018-08-20T11:27:36Z","updated_at":"2018-08-20T11:27:36Z","author_association":"CONTRIBUTOR","body":"I agree @MartinMuzatko there was some discussion on this a while back (for the life of me can't find the issue I created :laughing: )\r\n\r\nEveryone has different case types they normally use, I think honestly Strapi shouldn't limit users to a particular type and just handle the creation and management as far as needed, actual display values shouldn't be breaking thing (Both in the AdminUI and in the Rest/GraphQL response)\r\n\r\nIf I have a `camelCase` or a `break_case` being shown in the Rest strapi should handle these however it needs to in the backend (and database) but leave them in the frontend."}}
{"actor":{"display_login":"derrickmehaffy"}}