{"action":"created","issue":{"url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/1204","repository_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage","labels_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/1204/labels{/name}","comments_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/1204/comments","events_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/1204/events","html_url":"https://github.com/samselikoff/ember-cli-mirage/issues/1204","id":269630029,"node_id":"MDU6SXNzdWUyNjk2MzAwMjk=","number":1204,"title":"0.4.0 does not include relationships","user":{"login":"kielni","id":1649528,"node_id":"MDQ6VXNlcjE2NDk1Mjg=","avatar_url":"https://avatars2.githubusercontent.com/u/1649528?v=4","gravatar_id":"","url":"https://api.github.com/users/kielni","html_url":"https://github.com/kielni","followers_url":"https://api.github.com/users/kielni/followers","following_url":"https://api.github.com/users/kielni/following{/other_user}","gists_url":"https://api.github.com/users/kielni/gists{/gist_id}","starred_url":"https://api.github.com/users/kielni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kielni/subscriptions","organizations_url":"https://api.github.com/users/kielni/orgs","repos_url":"https://api.github.com/users/kielni/repos","events_url":"https://api.github.com/users/kielni/events{/privacy}","received_events_url":"https://api.github.com/users/kielni/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2017-10-30T14:55:37Z","updated_at":"2018-07-22T19:33:10Z","closed_at":"2018-02-01T17:19:46Z","author_association":"NONE","body":"Upgrading from 0.3.3 to 0.4.0 broke my acceptance tests that use objects with `belongsTo` relationships. My tests fail when trying to navigate through the `belongsTo` because the relationships were not included.  For example, with a `bill` model that has `meter: belongsTo('meter')`, `bill.meter.id` is undefined, because the `meter` relationship was not included in the response.\r\n\r\nI tried Mirage Boilerplate Twiddle but got an alert that \"The gist is missing or secret\"\r\n\r\nMy `bill` model looks like this:\r\n```\r\n  meter: DS.belongsTo('meter'),\r\n  initial: DS.attr('date),\r\n```\r\n\r\nMy real API and Mirage 0.3.3 ([_getResourceObjectForModel](https://github.com/samselikoff/ember-cli-mirage/blob/ee0efc89615c0ae0553a5407286fcde4f17d7382/addon/serializers/json-api-serializer.js#L167)) return data like this:\r\n\r\n```\r\n{\r\n    \"type\": \"bill-summary\",\r\n    \"attributes\": {\r\n        \"initial\": \"2014-07-02\"\r\n    },\r\n    \"id\": \"4170595602188\",\r\n    \"relationships\": {\r\n        \"meter\": {\r\n            \"data\": {\r\n                \"type\": \"meter\",\r\n                \"id\": \"1971049867684\"\r\n            }\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nWith 0.4.0, there are no relationships included because [_maybeAddRelationshipsToResourceObjectForModel](https://github.com/samselikoff/ember-cli-mirage/blob/master/addon/serializers/json-api-serializer.js#L181) includes them only if `hasLinksForRelationship`, `alwaysIncludeLinkageData`, or `this._relationshipIsIncluded`  Data returned by Mirage 0.4.0:\r\n\r\n```\r\n{\r\n    \"type\":\"bill-summary\",\r\n    \"id\":\"1\",\r\n    \"attributes\": {\r\n        \"initial\": \"2014-07-02\"\r\n    }\r\n}\r\n```\r\n\r\nMy real API does not add links or include relationships for this model, and `alwaysIncludeLinkageData`is [defaults to false](https://github.com/samselikoff/ember-cli-mirage/blob/master/addon/serializers/json-api-serializer.js#L221)\r\n\r\nI think this changed here: https://github.com/samselikoff/ember-cli-mirage/commit/ab87ac40747d1f46e8b5d6fa22bcfa133271a07f  I expect can work around this by setting `alwaysIncludeLinkageData` on every model with `belongsTo` relationships, but I'd rather that my Mirage API responses match my real API responses as much as possible.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/comments/406890823","html_url":"https://github.com/samselikoff/ember-cli-mirage/issues/1204#issuecomment-406890823","issue_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/1204","id":406890823,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNjg5MDgyMw==","user":{"login":"samselikoff","id":2922250,"node_id":"MDQ6VXNlcjI5MjIyNTA=","avatar_url":"https://avatars1.githubusercontent.com/u/2922250?v=4","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":"2018-07-22T19:33:10Z","updated_at":"2018-07-22T19:33:10Z","author_association":"OWNER","body":"Nope it’s not, we need to document it. I’ve just fallen behind\nOn Sun, Jul 22, 2018 at 2:38 PM George van Vliet <notifications@github.com>\nwrote:\n\n> @samselikoff <https://github.com/samselikoff> Is the\n> alwaysIncludeLinkageData property omitted from the serializer\n> documentation by intent?\n> It is only mentioned in your blogpost. Took me a while to run into the\n> blogpost in a serendipitous way, others might not be so lucky.\n>\n> —\n> You are receiving this because you were mentioned.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/samselikoff/ember-cli-mirage/issues/1204#issuecomment-406887445>,\n> or mute the thread\n> <https://github.com/notifications/unsubscribe-auth/ACyXCnmrEATV__4awfc_i7-f16n2lR6cks5uJMaMgaJpZM4QLUJA>\n> .\n>\n"}}
{"actor":{"display_login":"samselikoff"}}