{"action":"created","comment":{"url":"https://api.github.com/repos/one0fnine/QnA/pulls/comments/62414435","id":62414435,"diff_hunk":"@@ -1,23 +1,31 @@\n class AnswersController < ApplicationController\n-  before_action :set_question, only: [:new, :create]\n-\n-  def index\n-    @answers = Answer.all\n-  end\n+  before_action :authenticate_user!\n+  before_action :set_question\n \n   def new\n     @answer = @question.answers.new\n   end\n \n   def create\n     @answer = @question.answers.new(answer_params)\n+    @answer.user_id = current_user.id","path":"app/controllers/answers_controller.rb","position":16,"original_position":16,"commit_id":"8833a23e0a1f9bc5c464f6e3e7a374a6e73479e4","original_commit_id":"8833a23e0a1f9bc5c464f6e3e7a374a6e73479e4","user":{"login":"vkurennov","id":968537,"avatar_url":"https://avatars.githubusercontent.com/u/968537?v=3","gravatar_id":"","url":"https://api.github.com/users/vkurennov","html_url":"https://github.com/vkurennov","followers_url":"https://api.github.com/users/vkurennov/followers","following_url":"https://api.github.com/users/vkurennov/following{/other_user}","gists_url":"https://api.github.com/users/vkurennov/gists{/gist_id}","starred_url":"https://api.github.com/users/vkurennov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkurennov/subscriptions","organizations_url":"https://api.github.com/users/vkurennov/orgs","repos_url":"https://api.github.com/users/vkurennov/repos","events_url":"https://api.github.com/users/vkurennov/events{/privacy}","received_events_url":"https://api.github.com/users/vkurennov/received_events","type":"User","site_admin":false},"body":"Не надо связывать по id, за нас это делаеть rails. Связывай по объектам: `@answer.user = current_user`","created_at":"2016-05-07T09:33:52Z","updated_at":"2016-05-07T09:33:52Z","html_url":"https://github.com/one0fnine/QnA/pull/3#discussion_r62414435","pull_request_url":"https://api.github.com/repos/one0fnine/QnA/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/one0fnine/QnA/pulls/comments/62414435"},"html":{"href":"https://github.com/one0fnine/QnA/pull/3#discussion_r62414435"},"pull_request":{"href":"https://api.github.com/repos/one0fnine/QnA/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/one0fnine/QnA/pulls/3","id":69195861,"html_url":"https://github.com/one0fnine/QnA/pull/3","diff_url":"https://github.com/one0fnine/QnA/pull/3.diff","patch_url":"https://github.com/one0fnine/QnA/pull/3.patch","issue_url":"https://api.github.com/repos/one0fnine/QnA/issues/3","number":3,"state":"open","locked":false,"title":"feature/registration and authentification user","user":{"login":"one0fnine","id":7098834,"avatar_url":"https://avatars.githubusercontent.com/u/7098834?v=3","gravatar_id":"","url":"https://api.github.com/users/one0fnine","html_url":"https://github.com/one0fnine","followers_url":"https://api.github.com/users/one0fnine/followers","following_url":"https://api.github.com/users/one0fnine/following{/other_user}","gists_url":"https://api.github.com/users/one0fnine/gists{/gist_id}","starred_url":"https://api.github.com/users/one0fnine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/one0fnine/subscriptions","organizations_url":"https://api.github.com/users/one0fnine/orgs","repos_url":"https://api.github.com/users/one0fnine/repos","events_url":"https://api.github.com/users/one0fnine/events{/privacy}","received_events_url":"https://api.github.com/users/one0fnine/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-05-06T19:06:57Z","updated_at":"2016-05-07T09:33:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d00c8970a8fe55911e81ff0a29e46d62d7a3c95e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/one0fnine/QnA/pulls/3/commits","review_comments_url":"https://api.github.com/repos/one0fnine/QnA/pulls/3/comments","review_comment_url":"https://api.github.com/repos/one0fnine/QnA/pulls/comments{/number}","comments_url":"https://api.github.com/repos/one0fnine/QnA/issues/3/comments","statuses_url":"https://api.github.com/repos/one0fnine/QnA/statuses/8833a23e0a1f9bc5c464f6e3e7a374a6e73479e4","head":{"label":"one0fnine:feature/registration_and_authentification_user","ref":"feature/registration_and_authentification_user","sha":"8833a23e0a1f9bc5c464f6e3e7a374a6e73479e4","user":{"login":"one0fnine","id":7098834,"avatar_url":"https://avatars.githubusercontent.com/u/7098834?v=3","gravatar_id":"","url":"https://api.github.com/users/one0fnine","html_url":"https://github.com/one0fnine","followers_url":"https://api.github.com/users/one0fnine/followers","following_url":"https://api.github.com/users/one0fnine/following{/other_user}","gists_url":"https://api.github.com/users/one0fnine/gists{/gist_id}","starred_url":"https://api.github.com/users/one0fnine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/one0fnine/subscriptions","organizations_url":"https://api.github.com/users/one0fnine/orgs","repos_url":"https://api.github.com/users/one0fnine/repos","events_url":"https://api.github.com/users/one0fnine/events{/privacy}","received_events_url":"https://api.github.com/users/one0fnine/received_events","type":"User","site_admin":false},"repo":{"id":57035511,"name":"QnA","full_name":"one0fnine/QnA","owner":{"login":"one0fnine","id":7098834,"avatar_url":"https://avatars.githubusercontent.com/u/7098834?v=3","gravatar_id":"","url":"https://api.github.com/users/one0fnine","html_url":"https://github.com/one0fnine","followers_url":"https://api.github.com/users/one0fnine/followers","following_url":"https://api.github.com/users/one0fnine/following{/other_user}","gists_url":"https://api.github.com/users/one0fnine/gists{/gist_id}","starred_url":"https://api.github.com/users/one0fnine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/one0fnine/subscriptions","organizations_url":"https://api.github.com/users/one0fnine/orgs","repos_url":"https://api.github.com/users/one0fnine/repos","events_url":"https://api.github.com/users/one0fnine/events{/privacy}","received_events_url":"https://api.github.com/users/one0fnine/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/one0fnine/QnA","description":"","fork":false,"url":"https://api.github.com/repos/one0fnine/QnA","forks_url":"https://api.github.com/repos/one0fnine/QnA/forks","keys_url":"https://api.github.com/repos/one0fnine/QnA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/one0fnine/QnA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/one0fnine/QnA/teams","hooks_url":"https://api.github.com/repos/one0fnine/QnA/hooks","issue_events_url":"https://api.github.com/repos/one0fnine/QnA/issues/events{/number}","events_url":"https://api.github.com/repos/one0fnine/QnA/events","assignees_url":"https://api.github.com/repos/one0fnine/QnA/assignees{/user}","branches_url":"https://api.github.com/repos/one0fnine/QnA/branches{/branch}","tags_url":"https://api.github.com/repos/one0fnine/QnA/tags","blobs_url":"https://api.github.com/repos/one0fnine/QnA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/one0fnine/QnA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/one0fnine/QnA/git/refs{/sha}","trees_url":"https://api.github.com/repos/one0fnine/QnA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/one0fnine/QnA/statuses/{sha}","languages_url":"https://api.github.com/repos/one0fnine/QnA/languages","stargazers_url":"https://api.github.com/repos/one0fnine/QnA/stargazers","contributors_url":"https://api.github.com/repos/one0fnine/QnA/contributors","subscribers_url":"https://api.github.com/repos/one0fnine/QnA/subscribers","subscription_url":"https://api.github.com/repos/one0fnine/QnA/subscription","commits_url":"https://api.github.com/repos/one0fnine/QnA/commits{/sha}","git_commits_url":"https://api.github.com/repos/one0fnine/QnA/git/commits{/sha}","comments_url":"https://api.github.com/repos/one0fnine/QnA/comments{/number}","issue_comment_url":"https://api.github.com/repos/one0fnine/QnA/issues/comments{/number}","contents_url":"https://api.github.com/repos/one0fnine/QnA/contents/{+path}","compare_url":"https://api.github.com/repos/one0fnine/QnA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/one0fnine/QnA/merges","archive_url":"https://api.github.com/repos/one0fnine/QnA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/one0fnine/QnA/downloads","issues_url":"https://api.github.com/repos/one0fnine/QnA/issues{/number}","pulls_url":"https://api.github.com/repos/one0fnine/QnA/pulls{/number}","milestones_url":"https://api.github.com/repos/one0fnine/QnA/milestones{/number}","notifications_url":"https://api.github.com/repos/one0fnine/QnA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/one0fnine/QnA/labels{/name}","releases_url":"https://api.github.com/repos/one0fnine/QnA/releases{/id}","deployments_url":"https://api.github.com/repos/one0fnine/QnA/deployments","created_at":"2016-04-25T11:12:18Z","updated_at":"2016-04-25T11:25:02Z","pushed_at":"2016-05-06T19:06:58Z","git_url":"git://github.com/one0fnine/QnA.git","ssh_url":"git@github.com:one0fnine/QnA.git","clone_url":"https://github.com/one0fnine/QnA.git","svn_url":"https://github.com/one0fnine/QnA","homepage":null,"size":79,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"one0fnine:master","ref":"master","sha":"d4b47e24672ad738c179810b2b2b3f70a3e6e494","user":{"login":"one0fnine","id":7098834,"avatar_url":"https://avatars.githubusercontent.com/u/7098834?v=3","gravatar_id":"","url":"https://api.github.com/users/one0fnine","html_url":"https://github.com/one0fnine","followers_url":"https://api.github.com/users/one0fnine/followers","following_url":"https://api.github.com/users/one0fnine/following{/other_user}","gists_url":"https://api.github.com/users/one0fnine/gists{/gist_id}","starred_url":"https://api.github.com/users/one0fnine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/one0fnine/subscriptions","organizations_url":"https://api.github.com/users/one0fnine/orgs","repos_url":"https://api.github.com/users/one0fnine/repos","events_url":"https://api.github.com/users/one0fnine/events{/privacy}","received_events_url":"https://api.github.com/users/one0fnine/received_events","type":"User","site_admin":false},"repo":{"id":57035511,"name":"QnA","full_name":"one0fnine/QnA","owner":{"login":"one0fnine","id":7098834,"avatar_url":"https://avatars.githubusercontent.com/u/7098834?v=3","gravatar_id":"","url":"https://api.github.com/users/one0fnine","html_url":"https://github.com/one0fnine","followers_url":"https://api.github.com/users/one0fnine/followers","following_url":"https://api.github.com/users/one0fnine/following{/other_user}","gists_url":"https://api.github.com/users/one0fnine/gists{/gist_id}","starred_url":"https://api.github.com/users/one0fnine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/one0fnine/subscriptions","organizations_url":"https://api.github.com/users/one0fnine/orgs","repos_url":"https://api.github.com/users/one0fnine/repos","events_url":"https://api.github.com/users/one0fnine/events{/privacy}","received_events_url":"https://api.github.com/users/one0fnine/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/one0fnine/QnA","description":"","fork":false,"url":"https://api.github.com/repos/one0fnine/QnA","forks_url":"https://api.github.com/repos/one0fnine/QnA/forks","keys_url":"https://api.github.com/repos/one0fnine/QnA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/one0fnine/QnA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/one0fnine/QnA/teams","hooks_url":"https://api.github.com/repos/one0fnine/QnA/hooks","issue_events_url":"https://api.github.com/repos/one0fnine/QnA/issues/events{/number}","events_url":"https://api.github.com/repos/one0fnine/QnA/events","assignees_url":"https://api.github.com/repos/one0fnine/QnA/assignees{/user}","branches_url":"https://api.github.com/repos/one0fnine/QnA/branches{/branch}","tags_url":"https://api.github.com/repos/one0fnine/QnA/tags","blobs_url":"https://api.github.com/repos/one0fnine/QnA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/one0fnine/QnA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/one0fnine/QnA/git/refs{/sha}","trees_url":"https://api.github.com/repos/one0fnine/QnA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/one0fnine/QnA/statuses/{sha}","languages_url":"https://api.github.com/repos/one0fnine/QnA/languages","stargazers_url":"https://api.github.com/repos/one0fnine/QnA/stargazers","contributors_url":"https://api.github.com/repos/one0fnine/QnA/contributors","subscribers_url":"https://api.github.com/repos/one0fnine/QnA/subscribers","subscription_url":"https://api.github.com/repos/one0fnine/QnA/subscription","commits_url":"https://api.github.com/repos/one0fnine/QnA/commits{/sha}","git_commits_url":"https://api.github.com/repos/one0fnine/QnA/git/commits{/sha}","comments_url":"https://api.github.com/repos/one0fnine/QnA/comments{/number}","issue_comment_url":"https://api.github.com/repos/one0fnine/QnA/issues/comments{/number}","contents_url":"https://api.github.com/repos/one0fnine/QnA/contents/{+path}","compare_url":"https://api.github.com/repos/one0fnine/QnA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/one0fnine/QnA/merges","archive_url":"https://api.github.com/repos/one0fnine/QnA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/one0fnine/QnA/downloads","issues_url":"https://api.github.com/repos/one0fnine/QnA/issues{/number}","pulls_url":"https://api.github.com/repos/one0fnine/QnA/pulls{/number}","milestones_url":"https://api.github.com/repos/one0fnine/QnA/milestones{/number}","notifications_url":"https://api.github.com/repos/one0fnine/QnA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/one0fnine/QnA/labels{/name}","releases_url":"https://api.github.com/repos/one0fnine/QnA/releases{/id}","deployments_url":"https://api.github.com/repos/one0fnine/QnA/deployments","created_at":"2016-04-25T11:12:18Z","updated_at":"2016-04-25T11:25:02Z","pushed_at":"2016-05-06T19:06:58Z","git_url":"git://github.com/one0fnine/QnA.git","ssh_url":"git@github.com:one0fnine/QnA.git","clone_url":"https://github.com/one0fnine/QnA.git","svn_url":"https://github.com/one0fnine/QnA","homepage":null,"size":79,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/one0fnine/QnA/pulls/3"},"html":{"href":"https://github.com/one0fnine/QnA/pull/3"},"issue":{"href":"https://api.github.com/repos/one0fnine/QnA/issues/3"},"comments":{"href":"https://api.github.com/repos/one0fnine/QnA/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/one0fnine/QnA/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/one0fnine/QnA/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/one0fnine/QnA/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/one0fnine/QnA/statuses/8833a23e0a1f9bc5c464f6e3e7a374a6e73479e4"}}}}