{"action":"closed","issue":{"url":"https://api.github.com/repos/emberjs/data/issues/3556","labels_url":"https://api.github.com/repos/emberjs/data/issues/3556/labels{/name}","comments_url":"https://api.github.com/repos/emberjs/data/issues/3556/comments","events_url":"https://api.github.com/repos/emberjs/data/issues/3556/events","html_url":"https://github.com/emberjs/data/issues/3556","id":95701003,"number":3556,"title":"hasMany in JSON API with single item in relationship never materializes","user":{"login":"nickschot","id":334789,"avatar_url":"https://avatars.githubusercontent.com/u/334789?v=3","gravatar_id":"","url":"https://api.github.com/users/nickschot","html_url":"https://github.com/nickschot","followers_url":"https://api.github.com/users/nickschot/followers","following_url":"https://api.github.com/users/nickschot/following{/other_user}","gists_url":"https://api.github.com/users/nickschot/gists{/gist_id}","starred_url":"https://api.github.com/users/nickschot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickschot/subscriptions","organizations_url":"https://api.github.com/users/nickschot/orgs","repos_url":"https://api.github.com/users/nickschot/repos","events_url":"https://api.github.com/users/nickschot/events{/privacy}","received_events_url":"https://api.github.com/users/nickschot/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-17T17:09:21Z","updated_at":"2015-07-21T08:02:57Z","closed_at":"2015-07-21T08:02:57Z","body":"I found an issue with async relationships in combination with JSON API. \r\n\r\nThe model hook in the route returns a `book`. This `book` has a hasMany relationship to `page` which has a hasMany relationship to `word`. In the afterModel hook, firstly the `pages` are loaded with `book.get('pages')`. When they are all resolved, the words are loaded from the pages with `page.get('words')`. \r\n\r\nThis works perfectly fine as long as the page has more than one word. When only one word is provided in the JSON API payload, page.get('words') never ends up having the single word, and remains empty.\r\n\r\nIn all cases all `words` are correctly requested from and sent by the JSON API server and the records are showing up correctly in the ember inspector data tab. In the ember inspector, the relationship from page to word also ends up empty.\r\n\r\nThe relevant piece of the JSON API response of the `page` with a relationship to a single `word`:\r\n \r\n```\r\n\"relationships\":{\r\n\t\"book\":{\r\n\t\t\"links\":{\r\n\t\t\t\"self\":\"/pages/8fac5bce1fa3af360135af8b08602447/relationships/book\",\r\n\t\t\t\"related\":\"/pages/8fac5bce1fa3af360135af8b08602447/book\"\r\n\t\t},\r\n\t\t\"data\":{\r\n\t\t\t\"type\":\"books\",\r\n\t\t\t\"id\":\"c040c00b6c344d434c58147b02a5f153\"\r\n\t\t}\r\n\t},\r\n\t\"words\":{\r\n\t\t\"links\":{\r\n\t\t\t\"self\":\"/pages/8fac5bce1fa3af360135af8b08602447/relationships/words\",\r\n\t\t\t\"related\":\"/pages/8fac5bce1fa3af360135af8b08602447/words\"\r\n\t\t},\r\n\t\t\"data\":[\r\n\t\t\t{\r\n\t\t\t\t\"type\":\"words\",\r\n\t\t\t\t\"id\":\"d8e67884e79de84f6d22cf3cf2ff1bf1\"\r\n\t\t\t}\r\n\t\t]\r\n\t}\r\n}\r\n```\r\n\r\nEmber-data 1.13.5\r\nEmber 1.13.4"}}