{"action":"closed","issue":{"url":"https://api.github.com/repos/adonisjs/adonis-lucid/issues/4","labels_url":"https://api.github.com/repos/adonisjs/adonis-lucid/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/adonisjs/adonis-lucid/issues/4/comments","events_url":"https://api.github.com/repos/adonisjs/adonis-lucid/issues/4/events","html_url":"https://github.com/adonisjs/adonis-lucid/issues/4","id":111904612,"number":4,"title":"Not saving multiple associations","user":{"login":"brenolf","id":1520534,"avatar_url":"https://avatars.githubusercontent.com/u/1520534?v=3","gravatar_id":"","url":"https://api.github.com/users/brenolf","html_url":"https://github.com/brenolf","followers_url":"https://api.github.com/users/brenolf/followers","following_url":"https://api.github.com/users/brenolf/following{/other_user}","gists_url":"https://api.github.com/users/brenolf/gists{/gist_id}","starred_url":"https://api.github.com/users/brenolf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brenolf/subscriptions","organizations_url":"https://api.github.com/users/brenolf/orgs","repos_url":"https://api.github.com/users/brenolf/repos","events_url":"https://api.github.com/users/brenolf/events{/privacy}","received_events_url":"https://api.github.com/users/brenolf/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/adonisjs/adonis-lucid/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":{"login":"thetutlage","id":1706381,"avatar_url":"https://avatars.githubusercontent.com/u/1706381?v=3","gravatar_id":"","url":"https://api.github.com/users/thetutlage","html_url":"https://github.com/thetutlage","followers_url":"https://api.github.com/users/thetutlage/followers","following_url":"https://api.github.com/users/thetutlage/following{/other_user}","gists_url":"https://api.github.com/users/thetutlage/gists{/gist_id}","starred_url":"https://api.github.com/users/thetutlage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thetutlage/subscriptions","organizations_url":"https://api.github.com/users/thetutlage/orgs","repos_url":"https://api.github.com/users/thetutlage/repos","events_url":"https://api.github.com/users/thetutlage/events{/privacy}","received_events_url":"https://api.github.com/users/thetutlage/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2015-10-16T20:27:29Z","updated_at":"2015-10-17T20:19:42Z","closed_at":"2015-10-17T20:19:42Z","body":"When trying to add multiple `belongsTo` relationships, only the last one is actually saved.\r\n\r\nFor instance:\r\n```js\r\nlet user = yield User.find(1)\r\nlet game = yield Game.find(1)\r\n\r\nlet opinion = new Opinion\r\n\r\nopinion.game().associate(game)\r\nopinion.user().associate(user)\r\n\r\nyield opinion.create()\r\n```\r\n\r\nWill add a tuple in the DB which has `user_id = 1` and `game_id = NULL`, whereas reversing the association lines will add  `user_id = NULL` and `game_id = 1`."}}