{"action":"created","comment":{"url":"https://api.github.com/repos/Deobed/first_project/pulls/comments/32406771","id":32406771,"diff_hunk":"@@ -20,14 +20,30 @@ def destroy\n    if current_user.id == @answer.user_id\n      @answer.destroy\n    end\n-   redirect_to question_path(@answer.question)\n  end\n  \n  def show\n    @answer = Answer.find(params[:id])\n  end\n-\n-  private\n+ \n+ def update\n+   @answer = Answer.find(params[:id])\n+   if params.has_key?\"rating\"\n+     if @answer.question.user_id == current_user.id\n+       @rating = Answer.find_by_question_id_and_rating(@answer.question.id, true)\n+       @rating.update_attribute('rating', false) if @rating\n+     end\n+     @answer.update_attribute('rating', true)\n+     @type = 'rating'\n+   else\n+     if current_user.id == @answer.user_id","path":"app/controllers/answers_controller.rb","position":23,"original_position":23,"commit_id":"20ad0cbc47b081aeade91ce88053fb2ee645ce83","original_commit_id":"20ad0cbc47b081aeade91ce88053fb2ee645ce83","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":"Если в теле if только одна строчка, то лучше записать все в однострочник","created_at":"2015-06-15T10:14:27Z","updated_at":"2015-06-15T10:14:27Z","html_url":"https://github.com/Deobed/first_project/pull/5#discussion_r32406771","pull_request_url":"https://api.github.com/repos/Deobed/first_project/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/Deobed/first_project/pulls/comments/32406771"},"html":{"href":"https://github.com/Deobed/first_project/pull/5#discussion_r32406771"},"pull_request":{"href":"https://api.github.com/repos/Deobed/first_project/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/Deobed/first_project/pulls/5","id":37641706,"html_url":"https://github.com/Deobed/first_project/pull/5","diff_url":"https://github.com/Deobed/first_project/pull/5.diff","patch_url":"https://github.com/Deobed/first_project/pull/5.patch","issue_url":"https://api.github.com/repos/Deobed/first_project/issues/5","number":5,"state":"open","locked":false,"title":"Lesson 7","user":{"login":"Deobed","id":754414,"avatar_url":"https://avatars.githubusercontent.com/u/754414?v=3","gravatar_id":"","url":"https://api.github.com/users/Deobed","html_url":"https://github.com/Deobed","followers_url":"https://api.github.com/users/Deobed/followers","following_url":"https://api.github.com/users/Deobed/following{/other_user}","gists_url":"https://api.github.com/users/Deobed/gists{/gist_id}","starred_url":"https://api.github.com/users/Deobed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Deobed/subscriptions","organizations_url":"https://api.github.com/users/Deobed/orgs","repos_url":"https://api.github.com/users/Deobed/repos","events_url":"https://api.github.com/users/Deobed/events{/privacy}","received_events_url":"https://api.github.com/users/Deobed/received_events","type":"User","site_admin":false},"body":"Ajax part 2","created_at":"2015-06-14T13:46:17Z","updated_at":"2015-06-15T10:14:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"53e76faa22bb131686f3fd10f46ab9dd09de4ad0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Deobed/first_project/pulls/5/commits","review_comments_url":"https://api.github.com/repos/Deobed/first_project/pulls/5/comments","review_comment_url":"https://api.github.com/repos/Deobed/first_project/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Deobed/first_project/issues/5/comments","statuses_url":"https://api.github.com/repos/Deobed/first_project/statuses/20ad0cbc47b081aeade91ce88053fb2ee645ce83","head":{"label":"Deobed:lesson_7","ref":"lesson_7","sha":"20ad0cbc47b081aeade91ce88053fb2ee645ce83","user":{"login":"Deobed","id":754414,"avatar_url":"https://avatars.githubusercontent.com/u/754414?v=3","gravatar_id":"","url":"https://api.github.com/users/Deobed","html_url":"https://github.com/Deobed","followers_url":"https://api.github.com/users/Deobed/followers","following_url":"https://api.github.com/users/Deobed/following{/other_user}","gists_url":"https://api.github.com/users/Deobed/gists{/gist_id}","starred_url":"https://api.github.com/users/Deobed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Deobed/subscriptions","organizations_url":"https://api.github.com/users/Deobed/orgs","repos_url":"https://api.github.com/users/Deobed/repos","events_url":"https://api.github.com/users/Deobed/events{/privacy}","received_events_url":"https://api.github.com/users/Deobed/received_events","type":"User","site_admin":false},"repo":{"id":36681362,"name":"first_project","full_name":"Deobed/first_project","owner":{"login":"Deobed","id":754414,"avatar_url":"https://avatars.githubusercontent.com/u/754414?v=3","gravatar_id":"","url":"https://api.github.com/users/Deobed","html_url":"https://github.com/Deobed","followers_url":"https://api.github.com/users/Deobed/followers","following_url":"https://api.github.com/users/Deobed/following{/other_user}","gists_url":"https://api.github.com/users/Deobed/gists{/gist_id}","starred_url":"https://api.github.com/users/Deobed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Deobed/subscriptions","organizations_url":"https://api.github.com/users/Deobed/orgs","repos_url":"https://api.github.com/users/Deobed/repos","events_url":"https://api.github.com/users/Deobed/events{/privacy}","received_events_url":"https://api.github.com/users/Deobed/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Deobed/first_project","description":"","fork":false,"url":"https://api.github.com/repos/Deobed/first_project","forks_url":"https://api.github.com/repos/Deobed/first_project/forks","keys_url":"https://api.github.com/repos/Deobed/first_project/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Deobed/first_project/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Deobed/first_project/teams","hooks_url":"https://api.github.com/repos/Deobed/first_project/hooks","issue_events_url":"https://api.github.com/repos/Deobed/first_project/issues/events{/number}","events_url":"https://api.github.com/repos/Deobed/first_project/events","assignees_url":"https://api.github.com/repos/Deobed/first_project/assignees{/user}","branches_url":"https://api.github.com/repos/Deobed/first_project/branches{/branch}","tags_url":"https://api.github.com/repos/Deobed/first_project/tags","blobs_url":"https://api.github.com/repos/Deobed/first_project/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Deobed/first_project/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Deobed/first_project/git/refs{/sha}","trees_url":"https://api.github.com/repos/Deobed/first_project/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Deobed/first_project/statuses/{sha}","languages_url":"https://api.github.com/repos/Deobed/first_project/languages","stargazers_url":"https://api.github.com/repos/Deobed/first_project/stargazers","contributors_url":"https://api.github.com/repos/Deobed/first_project/contributors","subscribers_url":"https://api.github.com/repos/Deobed/first_project/subscribers","subscription_url":"https://api.github.com/repos/Deobed/first_project/subscription","commits_url":"https://api.github.com/repos/Deobed/first_project/commits{/sha}","git_commits_url":"https://api.github.com/repos/Deobed/first_project/git/commits{/sha}","comments_url":"https://api.github.com/repos/Deobed/first_project/comments{/number}","issue_comment_url":"https://api.github.com/repos/Deobed/first_project/issues/comments{/number}","contents_url":"https://api.github.com/repos/Deobed/first_project/contents/{+path}","compare_url":"https://api.github.com/repos/Deobed/first_project/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Deobed/first_project/merges","archive_url":"https://api.github.com/repos/Deobed/first_project/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Deobed/first_project/downloads","issues_url":"https://api.github.com/repos/Deobed/first_project/issues{/number}","pulls_url":"https://api.github.com/repos/Deobed/first_project/pulls{/number}","milestones_url":"https://api.github.com/repos/Deobed/first_project/milestones{/number}","notifications_url":"https://api.github.com/repos/Deobed/first_project/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Deobed/first_project/labels{/name}","releases_url":"https://api.github.com/repos/Deobed/first_project/releases{/id}","created_at":"2015-06-01T18:49:50Z","updated_at":"2015-06-01T18:50:16Z","pushed_at":"2015-06-14T13:46:17Z","git_url":"git://github.com/Deobed/first_project.git","ssh_url":"git@github.com:Deobed/first_project.git","clone_url":"https://github.com/Deobed/first_project.git","svn_url":"https://github.com/Deobed/first_project","homepage":null,"size":244,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"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":"Deobed:master","ref":"master","sha":"0d398745bc39b6cba11aff6dc52f92d9e0c315bb","user":{"login":"Deobed","id":754414,"avatar_url":"https://avatars.githubusercontent.com/u/754414?v=3","gravatar_id":"","url":"https://api.github.com/users/Deobed","html_url":"https://github.com/Deobed","followers_url":"https://api.github.com/users/Deobed/followers","following_url":"https://api.github.com/users/Deobed/following{/other_user}","gists_url":"https://api.github.com/users/Deobed/gists{/gist_id}","starred_url":"https://api.github.com/users/Deobed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Deobed/subscriptions","organizations_url":"https://api.github.com/users/Deobed/orgs","repos_url":"https://api.github.com/users/Deobed/repos","events_url":"https://api.github.com/users/Deobed/events{/privacy}","received_events_url":"https://api.github.com/users/Deobed/received_events","type":"User","site_admin":false},"repo":{"id":36681362,"name":"first_project","full_name":"Deobed/first_project","owner":{"login":"Deobed","id":754414,"avatar_url":"https://avatars.githubusercontent.com/u/754414?v=3","gravatar_id":"","url":"https://api.github.com/users/Deobed","html_url":"https://github.com/Deobed","followers_url":"https://api.github.com/users/Deobed/followers","following_url":"https://api.github.com/users/Deobed/following{/other_user}","gists_url":"https://api.github.com/users/Deobed/gists{/gist_id}","starred_url":"https://api.github.com/users/Deobed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Deobed/subscriptions","organizations_url":"https://api.github.com/users/Deobed/orgs","repos_url":"https://api.github.com/users/Deobed/repos","events_url":"https://api.github.com/users/Deobed/events{/privacy}","received_events_url":"https://api.github.com/users/Deobed/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Deobed/first_project","description":"","fork":false,"url":"https://api.github.com/repos/Deobed/first_project","forks_url":"https://api.github.com/repos/Deobed/first_project/forks","keys_url":"https://api.github.com/repos/Deobed/first_project/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Deobed/first_project/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Deobed/first_project/teams","hooks_url":"https://api.github.com/repos/Deobed/first_project/hooks","issue_events_url":"https://api.github.com/repos/Deobed/first_project/issues/events{/number}","events_url":"https://api.github.com/repos/Deobed/first_project/events","assignees_url":"https://api.github.com/repos/Deobed/first_project/assignees{/user}","branches_url":"https://api.github.com/repos/Deobed/first_project/branches{/branch}","tags_url":"https://api.github.com/repos/Deobed/first_project/tags","blobs_url":"https://api.github.com/repos/Deobed/first_project/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Deobed/first_project/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Deobed/first_project/git/refs{/sha}","trees_url":"https://api.github.com/repos/Deobed/first_project/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Deobed/first_project/statuses/{sha}","languages_url":"https://api.github.com/repos/Deobed/first_project/languages","stargazers_url":"https://api.github.com/repos/Deobed/first_project/stargazers","contributors_url":"https://api.github.com/repos/Deobed/first_project/contributors","subscribers_url":"https://api.github.com/repos/Deobed/first_project/subscribers","subscription_url":"https://api.github.com/repos/Deobed/first_project/subscription","commits_url":"https://api.github.com/repos/Deobed/first_project/commits{/sha}","git_commits_url":"https://api.github.com/repos/Deobed/first_project/git/commits{/sha}","comments_url":"https://api.github.com/repos/Deobed/first_project/comments{/number}","issue_comment_url":"https://api.github.com/repos/Deobed/first_project/issues/comments{/number}","contents_url":"https://api.github.com/repos/Deobed/first_project/contents/{+path}","compare_url":"https://api.github.com/repos/Deobed/first_project/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Deobed/first_project/merges","archive_url":"https://api.github.com/repos/Deobed/first_project/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Deobed/first_project/downloads","issues_url":"https://api.github.com/repos/Deobed/first_project/issues{/number}","pulls_url":"https://api.github.com/repos/Deobed/first_project/pulls{/number}","milestones_url":"https://api.github.com/repos/Deobed/first_project/milestones{/number}","notifications_url":"https://api.github.com/repos/Deobed/first_project/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Deobed/first_project/labels{/name}","releases_url":"https://api.github.com/repos/Deobed/first_project/releases{/id}","created_at":"2015-06-01T18:49:50Z","updated_at":"2015-06-01T18:50:16Z","pushed_at":"2015-06-14T13:46:17Z","git_url":"git://github.com/Deobed/first_project.git","ssh_url":"git@github.com:Deobed/first_project.git","clone_url":"https://github.com/Deobed/first_project.git","svn_url":"https://github.com/Deobed/first_project","homepage":null,"size":244,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"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/Deobed/first_project/pulls/5"},"html":{"href":"https://github.com/Deobed/first_project/pull/5"},"issue":{"href":"https://api.github.com/repos/Deobed/first_project/issues/5"},"comments":{"href":"https://api.github.com/repos/Deobed/first_project/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/Deobed/first_project/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/Deobed/first_project/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Deobed/first_project/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/Deobed/first_project/statuses/20ad0cbc47b081aeade91ce88053fb2ee645ce83"}}}}