{"action":"created","issue":{"url":"https://api.github.com/repos/TeamCheckmate/chess_app/issues/10","labels_url":"https://api.github.com/repos/TeamCheckmate/chess_app/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/TeamCheckmate/chess_app/issues/10/comments","events_url":"https://api.github.com/repos/TeamCheckmate/chess_app/issues/10/events","html_url":"https://github.com/TeamCheckmate/chess_app/pull/10","id":65098953,"number":10,"title":"add game and piece models and update model files with associations","user":{"login":"bfhcodehacker","id":10818110,"avatar_url":"https://avatars.githubusercontent.com/u/10818110?v=3","gravatar_id":"","url":"https://api.github.com/users/bfhcodehacker","html_url":"https://github.com/bfhcodehacker","followers_url":"https://api.github.com/users/bfhcodehacker/followers","following_url":"https://api.github.com/users/bfhcodehacker/following{/other_user}","gists_url":"https://api.github.com/users/bfhcodehacker/gists{/gist_id}","starred_url":"https://api.github.com/users/bfhcodehacker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bfhcodehacker/subscriptions","organizations_url":"https://api.github.com/users/bfhcodehacker/orgs","repos_url":"https://api.github.com/users/bfhcodehacker/repos","events_url":"https://api.github.com/users/bfhcodehacker/events{/privacy}","received_events_url":"https://api.github.com/users/bfhcodehacker/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-29T21:32:18Z","updated_at":"2015-04-02T23:14:43Z","closed_at":"2015-04-01T18:28:23Z","pull_request":{"url":"https://api.github.com/repos/TeamCheckmate/chess_app/pulls/10","html_url":"https://github.com/TeamCheckmate/chess_app/pull/10","diff_url":"https://github.com/TeamCheckmate/chess_app/pull/10.diff","patch_url":"https://github.com/TeamCheckmate/chess_app/pull/10.patch"},"body":""},"comment":{"url":"https://api.github.com/repos/TeamCheckmate/chess_app/issues/comments/89074662","html_url":"https://github.com/TeamCheckmate/chess_app/pull/10#issuecomment-89074662","issue_url":"https://api.github.com/repos/TeamCheckmate/chess_app/issues/10","id":89074662,"user":{"login":"wengs","id":10138336,"avatar_url":"https://avatars.githubusercontent.com/u/10138336?v=3","gravatar_id":"","url":"https://api.github.com/users/wengs","html_url":"https://github.com/wengs","followers_url":"https://api.github.com/users/wengs/followers","following_url":"https://api.github.com/users/wengs/following{/other_user}","gists_url":"https://api.github.com/users/wengs/gists{/gist_id}","starred_url":"https://api.github.com/users/wengs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wengs/subscriptions","organizations_url":"https://api.github.com/users/wengs/orgs","repos_url":"https://api.github.com/users/wengs/repos","events_url":"https://api.github.com/users/wengs/events{/privacy}","received_events_url":"https://api.github.com/users/wengs/received_events","type":"User","site_admin":false},"created_at":"2015-04-02T23:14:43Z","updated_at":"2015-04-02T23:14:43Z","body":"I actually had a question about the association between the game and user model. We set a game belongs to a user, but if you look at the migration file of game, there is no a column for storing the foreign key, user_id in the game table although there are only white_player_id and black_player_id, which made me to think how the id of user is stored in the game table.\r\n\r\nFor example, in flixter, in the course controller, when we create a new course, we will do the following:\r\n```Ruby\r\ndef create\r\n  @course = current_user.courses.create(course_params)\r\nend\r\n``` \r\nThen the association between the course and user will be created. I wonder is the user's id is automatically stored by devise because of the name convention, :user_id? If so, does that mean we need a column called :user_id in the game table so devise would do all the job? Or we can do something like the following in the games controller:\r\n```Ruby\r\ndef create\r\n   @game= current_user.games.create(game_params)\r\n   @game.white_player_id = current_user.id            #depends on the user chooses white or black.\r\nend\r\n```\r\n"}}