{"action":"opened","issue":{"url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/507","labels_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/507/labels{/name}","comments_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/507/comments","events_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/507/events","html_url":"https://github.com/samselikoff/ember-cli-mirage/issues/507","id":127249132,"number":507,"title":"Duplicated ForeignKeys in schema","user":{"login":"ajcobo","id":1257276,"avatar_url":"https://avatars.githubusercontent.com/u/1257276?v=3","gravatar_id":"","url":"https://api.github.com/users/ajcobo","html_url":"https://github.com/ajcobo","followers_url":"https://api.github.com/users/ajcobo/followers","following_url":"https://api.github.com/users/ajcobo/following{/other_user}","gists_url":"https://api.github.com/users/ajcobo/gists{/gist_id}","starred_url":"https://api.github.com/users/ajcobo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajcobo/subscriptions","organizations_url":"https://api.github.com/users/ajcobo/orgs","repos_url":"https://api.github.com/users/ajcobo/repos","events_url":"https://api.github.com/users/ajcobo/events{/privacy}","received_events_url":"https://api.github.com/users/ajcobo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-18T15:26:18Z","updated_at":"2016-01-18T15:26:18Z","closed_at":null,"body":"When multiple relationships are defined:\r\n\r\n````javascript\r\n var User = Model.extend({\r\n    projects: Mirage.hasMany(),\r\n    tasks: Mirage.hasMany()\r\n  });\r\n\r\n  var Project = Model.extend({\r\n    user: Mirage.belongsTo(),\r\n    tasks: Mirage.hasMany()\r\n  });\r\n\r\n  var Task = Model.extend({\r\n    user: Mirage.belongsTo(),\r\n    project: Mirage.belongsTo()\r\n  });\r\n````\r\n\r\nIn this case:\r\n\r\n* User will not have foreignKeys \r\n* Task will have 2 foreignKeys: userId and projectId\r\n* **Project will have 2 foreignKeys userId**\r\n\r\nI've noticed that this gets worse with complex models.\r\n\r\nI'm more than willing to create a PR for this.\r\n\r\nWhere should I add the tests?\r\n\r\n"}}