{"action":"created","issue":{"url":"https://api.github.com/repos/tgriesser/bookshelf/issues/1123","repository_url":"https://api.github.com/repos/tgriesser/bookshelf","labels_url":"https://api.github.com/repos/tgriesser/bookshelf/issues/1123/labels{/name}","comments_url":"https://api.github.com/repos/tgriesser/bookshelf/issues/1123/comments","events_url":"https://api.github.com/repos/tgriesser/bookshelf/issues/1123/events","html_url":"https://github.com/tgriesser/bookshelf/issues/1123","id":132705266,"number":1123,"title":"Impossible to correctly populate the value","user":{"login":"mytototo","id":2677247,"avatar_url":"https://avatars.githubusercontent.com/u/2677247?v=3","gravatar_id":"","url":"https://api.github.com/users/mytototo","html_url":"https://github.com/mytototo","followers_url":"https://api.github.com/users/mytototo/followers","following_url":"https://api.github.com/users/mytototo/following{/other_user}","gists_url":"https://api.github.com/users/mytototo/gists{/gist_id}","starred_url":"https://api.github.com/users/mytototo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mytototo/subscriptions","organizations_url":"https://api.github.com/users/mytototo/orgs","repos_url":"https://api.github.com/users/mytototo/repos","events_url":"https://api.github.com/users/mytototo/events{/privacy}","received_events_url":"https://api.github.com/users/mytototo/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/tgriesser/bookshelf/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2016-02-10T13:51:18Z","updated_at":"2016-02-29T17:00:15Z","closed_at":"2016-02-10T19:37:29Z","body":"Hey !\r\n\r\nI am trying Bookshelf (with SQLite) for the first time and I encounter some difficulties regarding relationships. I have two models: `User` and `Article`. An `User` `hasOne` `Article` via `article` and an `Article` `belongsTo` one `User` via `author`.\r\n\r\n```js\r\nvar User, Article;\r\n\r\nUser = bookshelf.Model.extend({\r\n  tableName: 'user',\r\n  article: function() {\r\n    return this.hasOne(Article, 'author');\r\n  }\r\n});\r\n\r\nArticle = bookshelf.Model.extend({\r\n  tableName: 'article',\r\n  author: function() {\r\n    return this.belongsTo(User, 'article');\r\n  }\r\n});\r\n```\r\n\r\nUsing Koa, when I want to populate the value I do something like that:\r\n\r\n```js\r\nyield User.forge({\r\n  id: 3\r\n}).fetch({\r\n    withRelated: ['article']\r\n});\r\n```\r\n\r\nExpected response:\r\n\r\n```js\r\n{\r\n    \"id\": 3,\r\n    \"firstName\": \"John\",\r\n    \"lastName\": \"Doe\",\r\n    \"article\": {\r\n        \"id\": 5,\r\n        \"title\": \"Title for article #5\"\r\n    }\r\n}\r\n```\r\n\r\nActual response:\r\n\r\n```js\r\n{\r\n    \"id\": 3,\r\n    \"firstName\": \"John\",\r\n    \"lastName\": \"Doe\",\r\n    \"article\": {\r\n        \"id\": 3,\r\n        \"title\": \"Title for article #3\"\r\n    }\r\n}\r\n```\r\n\r\nIt seems that it's always returns the `Article` with the same `id` as the `User`.\r\n\r\nCan you help me please?\r\n\r\nThanks for your kind support.\r\nBests."},"comment":{"url":"https://api.github.com/repos/tgriesser/bookshelf/issues/comments/190288461","html_url":"https://github.com/tgriesser/bookshelf/issues/1123#issuecomment-190288461","issue_url":"https://api.github.com/repos/tgriesser/bookshelf/issues/1123","id":190288461,"user":{"login":"Aurelsicoko","id":4144726,"avatar_url":"https://avatars.githubusercontent.com/u/4144726?v=3","gravatar_id":"","url":"https://api.github.com/users/Aurelsicoko","html_url":"https://github.com/Aurelsicoko","followers_url":"https://api.github.com/users/Aurelsicoko/followers","following_url":"https://api.github.com/users/Aurelsicoko/following{/other_user}","gists_url":"https://api.github.com/users/Aurelsicoko/gists{/gist_id}","starred_url":"https://api.github.com/users/Aurelsicoko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aurelsicoko/subscriptions","organizations_url":"https://api.github.com/users/Aurelsicoko/orgs","repos_url":"https://api.github.com/users/Aurelsicoko/repos","events_url":"https://api.github.com/users/Aurelsicoko/events{/privacy}","received_events_url":"https://api.github.com/users/Aurelsicoko/received_events","type":"User","site_admin":false},"created_at":"2016-02-29T17:00:15Z","updated_at":"2016-02-29T17:00:15Z","body":"@ricardograca: Did you have time to take a look at this (my) issue? I'm sorry to insist but I'm blocked on it. Thanks for your time!"}}