{"action":"created","issue":{"url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/687","repository_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage","labels_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/687/labels{/name}","comments_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/687/comments","events_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/687/events","html_url":"https://github.com/samselikoff/ember-cli-mirage/issues/687","id":147015791,"number":687,"title":"Difficulty defining relationships","user":{"login":"Aaronfischer","id":5474591,"avatar_url":"https://avatars.githubusercontent.com/u/5474591?v=3","gravatar_id":"","url":"https://api.github.com/users/Aaronfischer","html_url":"https://github.com/Aaronfischer","followers_url":"https://api.github.com/users/Aaronfischer/followers","following_url":"https://api.github.com/users/Aaronfischer/following{/other_user}","gists_url":"https://api.github.com/users/Aaronfischer/gists{/gist_id}","starred_url":"https://api.github.com/users/Aaronfischer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aaronfischer/subscriptions","organizations_url":"https://api.github.com/users/Aaronfischer/orgs","repos_url":"https://api.github.com/users/Aaronfischer/repos","events_url":"https://api.github.com/users/Aaronfischer/events{/privacy}","received_events_url":"https://api.github.com/users/Aaronfischer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-08T19:22:40Z","updated_at":"2016-04-08T19:35:13Z","closed_at":null,"body":"I've read that one-to-one relationships are not directly supported, so then my next question is, what kind of an impact does this actually have?\r\nAm I still able to load `/assets/` that has a one-to-one belongsTo relationship with `/assets/:id/images` and have it fetch the belongsTo `image`?\r\n\r\nI'm having a tough time configuring this setup, heres what I have so far:\r\n```js\r\n// app/models/asset.js\r\nexport default DS.Model.extend({\r\n    image: DS.belongsTo('asset/image', {async: true}),\r\n    title: attr(),\r\n});\r\n\r\n// app/models/asset/image.js\r\nexport default DS.Model.extend({\r\n    asset: DS.belongsTo('asset', {async: true}),\r\n    title: attr(),\r\n});\r\n\r\n// mirage/factories/asset.js\r\nexport default Mirage.Factory.extend({\r\n    imageId(i) { return i + 1; },\r\n\r\n    title() { return faker.name.firstName() + ' ' + faker.name.lastName(); },\r\n});\r\n\r\n// mirage/factories/image.js\r\nexport default Mirage.Factory.extend({\r\n    title() { return faker.name.firstName() + ' ' + faker.name.lastName(); },\r\n    createdAt() { return moment(faker.date.past()).format('YYYY-MM-DD'); },\r\n    updatedAt() { return moment(faker.date.past()).format('YYYY-MM-DD'); },\r\n});\r\n\r\n// mirage/models/asset.js\r\nexport default Model.extend({\r\n    image: belongsTo('image'),\r\n});\r\n\r\n// mirage/models/image.js\r\nexport default Model.extend({\r\n    asset: belongsTo('asset'),\r\n});\r\n\r\n// mirage/scenarios/default.js\r\nexport default function(server) {\r\n  server.createList('image', 10);\r\n  server.createList('asset', 10);\r\n}\r\n\r\n// mirage/applications/asset.js\r\n/* NOTE: I'm not sure if I can use \"relationship:\" to have it lazyload the data or not? */\r\n// ApplicationSerializer is JSONAPIserializer\r\nexport default ApplicationSerializer.extend({\r\n    include: ['image'],\r\n});\r\n\r\n// mirage.config.js\r\n...\r\n    /**\r\n     * Assets\r\n     */\r\n    this.get('/assets', (schema, request) => {\r\n        if (request.queryParams) {\r\n            return schema.asset.where(Utils.filterObj(request.queryParams, schema.db['assets'], {}));\r\n        }\r\n\r\n        return schema.asset.all();\r\n    });\r\n\r\n    this.get('/assets/:id/images', (schema, request) => {\r\n        let asset = schema.asset.find(request.params.id);\r\n\r\n        return asset.images;\r\n    });\r\n}\r\n\r\n```\r\n\r\nThe response from /assets looks exactly like it should, its an array of objects and each object has a `relationships.image.data` which is `{id: '1', type: 'images'}`.\r\n\r\nHowever, the /assets/:id/images are not loading and no request is being made for them anywhere. I'm sure I could have missed something in my setup, do you see any mistakes?\r\nI'd love to share a link to the project, but I'm unable to (private repo). Let me know if there is anything else you need, other than this issue I've loved switching over to mirage, brilliantly crafted!"},"comment":{"url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/comments/207571573","html_url":"https://github.com/samselikoff/ember-cli-mirage/issues/687#issuecomment-207571573","issue_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/687","id":207571573,"user":{"login":"samselikoff","id":2922250,"avatar_url":"https://avatars.githubusercontent.com/u/2922250?v=3","gravatar_id":"","url":"https://api.github.com/users/samselikoff","html_url":"https://github.com/samselikoff","followers_url":"https://api.github.com/users/samselikoff/followers","following_url":"https://api.github.com/users/samselikoff/following{/other_user}","gists_url":"https://api.github.com/users/samselikoff/gists{/gist_id}","starred_url":"https://api.github.com/users/samselikoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samselikoff/subscriptions","organizations_url":"https://api.github.com/users/samselikoff/orgs","repos_url":"https://api.github.com/users/samselikoff/repos","events_url":"https://api.github.com/users/samselikoff/events{/privacy}","received_events_url":"https://api.github.com/users/samselikoff/received_events","type":"User","site_admin":false},"created_at":"2016-04-08T19:35:13Z","updated_at":"2016-04-08T19:35:13Z","body":"In your actual backend, what is the relationship? `asset` `has_one` `image`?"}}