{"action":"created","comment":{"url":"https://api.github.com/repos/CatDaVinci/qu-an/pulls/comments/62520786","id":62520786,"diff_hunk":"@@ -40,7 +45,7 @@ def destroy\n   private\n \n   def load_question\n-    @question = Question.find(params[:id])\n+    @question = current_user.questions.find(params[:id])","path":"app/controllers/questions_controller.rb","position":43,"original_position":43,"commit_id":"da7b0bd4ff3b1c6c615ef1174507c61921266ac8","original_commit_id":"da7b0bd4ff3b1c6c615ef1174507c61921266ac8","user":{"login":"palkan","id":1516722,"avatar_url":"https://avatars.githubusercontent.com/u/1516722?v=3","gravatar_id":"","url":"https://api.github.com/users/palkan","html_url":"https://github.com/palkan","followers_url":"https://api.github.com/users/palkan/followers","following_url":"https://api.github.com/users/palkan/following{/other_user}","gists_url":"https://api.github.com/users/palkan/gists{/gist_id}","starred_url":"https://api.github.com/users/palkan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palkan/subscriptions","organizations_url":"https://api.github.com/users/palkan/orgs","repos_url":"https://api.github.com/users/palkan/repos","events_url":"https://api.github.com/users/palkan/events{/privacy}","received_events_url":"https://api.github.com/users/palkan/received_events","type":"User","site_admin":false},"body":"Я так понимаю, ты таким образом решил убить двух зайцев: загрузить вопрос и сделать проверку на авторство?\r\n\r\nС таким подходом есть проблемы:\r\n- это не работает для _публичных_ методов, например, для `#show` (в итоге там пришлось делать загрузку вопроса по другому);\r\n- логика прав может поменяться; самое простое – добавляется роль _админа_, который может редактировать любые вопросы; этот метод придется переписывать;\r\n- ошибка, возникающая при попытке неавтора вызвать метод, будет не совсем верной (404 \"не найдено\" вместо 403 \"доступ закрыт\").\r\n\r\nВ общем, здесь нужно оставить как было, а проверку доступа сделать отдельно.","created_at":"2016-05-09T15:38:24Z","updated_at":"2016-05-09T15:38:24Z","html_url":"https://github.com/CatDaVinci/qu-an/pull/3#discussion_r62520786","pull_request_url":"https://api.github.com/repos/CatDaVinci/qu-an/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/CatDaVinci/qu-an/pulls/comments/62520786"},"html":{"href":"https://github.com/CatDaVinci/qu-an/pull/3#discussion_r62520786"},"pull_request":{"href":"https://api.github.com/repos/CatDaVinci/qu-an/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/CatDaVinci/qu-an/pulls/3","id":69274602,"html_url":"https://github.com/CatDaVinci/qu-an/pull/3","diff_url":"https://github.com/CatDaVinci/qu-an/pull/3.diff","patch_url":"https://github.com/CatDaVinci/qu-an/pull/3.patch","issue_url":"https://api.github.com/repos/CatDaVinci/qu-an/issues/3","number":3,"state":"open","locked":false,"title":"Feature/l5 1","user":{"login":"CatDaVinci","id":9443548,"avatar_url":"https://avatars.githubusercontent.com/u/9443548?v=3","gravatar_id":"","url":"https://api.github.com/users/CatDaVinci","html_url":"https://github.com/CatDaVinci","followers_url":"https://api.github.com/users/CatDaVinci/followers","following_url":"https://api.github.com/users/CatDaVinci/following{/other_user}","gists_url":"https://api.github.com/users/CatDaVinci/gists{/gist_id}","starred_url":"https://api.github.com/users/CatDaVinci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CatDaVinci/subscriptions","organizations_url":"https://api.github.com/users/CatDaVinci/orgs","repos_url":"https://api.github.com/users/CatDaVinci/repos","events_url":"https://api.github.com/users/CatDaVinci/events{/privacy}","received_events_url":"https://api.github.com/users/CatDaVinci/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-05-08T17:46:43Z","updated_at":"2016-05-09T15:38:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d5399bad105645d9030bff6dfacba707f03efcb1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/CatDaVinci/qu-an/pulls/3/commits","review_comments_url":"https://api.github.com/repos/CatDaVinci/qu-an/pulls/3/comments","review_comment_url":"https://api.github.com/repos/CatDaVinci/qu-an/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CatDaVinci/qu-an/issues/3/comments","statuses_url":"https://api.github.com/repos/CatDaVinci/qu-an/statuses/da7b0bd4ff3b1c6c615ef1174507c61921266ac8","head":{"label":"CatDaVinci:feature/L5-1","ref":"feature/L5-1","sha":"da7b0bd4ff3b1c6c615ef1174507c61921266ac8","user":{"login":"CatDaVinci","id":9443548,"avatar_url":"https://avatars.githubusercontent.com/u/9443548?v=3","gravatar_id":"","url":"https://api.github.com/users/CatDaVinci","html_url":"https://github.com/CatDaVinci","followers_url":"https://api.github.com/users/CatDaVinci/followers","following_url":"https://api.github.com/users/CatDaVinci/following{/other_user}","gists_url":"https://api.github.com/users/CatDaVinci/gists{/gist_id}","starred_url":"https://api.github.com/users/CatDaVinci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CatDaVinci/subscriptions","organizations_url":"https://api.github.com/users/CatDaVinci/orgs","repos_url":"https://api.github.com/users/CatDaVinci/repos","events_url":"https://api.github.com/users/CatDaVinci/events{/privacy}","received_events_url":"https://api.github.com/users/CatDaVinci/received_events","type":"User","site_admin":false},"repo":{"id":57122142,"name":"qu-an","full_name":"CatDaVinci/qu-an","owner":{"login":"CatDaVinci","id":9443548,"avatar_url":"https://avatars.githubusercontent.com/u/9443548?v=3","gravatar_id":"","url":"https://api.github.com/users/CatDaVinci","html_url":"https://github.com/CatDaVinci","followers_url":"https://api.github.com/users/CatDaVinci/followers","following_url":"https://api.github.com/users/CatDaVinci/following{/other_user}","gists_url":"https://api.github.com/users/CatDaVinci/gists{/gist_id}","starred_url":"https://api.github.com/users/CatDaVinci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CatDaVinci/subscriptions","organizations_url":"https://api.github.com/users/CatDaVinci/orgs","repos_url":"https://api.github.com/users/CatDaVinci/repos","events_url":"https://api.github.com/users/CatDaVinci/events{/privacy}","received_events_url":"https://api.github.com/users/CatDaVinci/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/CatDaVinci/qu-an","description":"rails-course","fork":false,"url":"https://api.github.com/repos/CatDaVinci/qu-an","forks_url":"https://api.github.com/repos/CatDaVinci/qu-an/forks","keys_url":"https://api.github.com/repos/CatDaVinci/qu-an/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CatDaVinci/qu-an/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CatDaVinci/qu-an/teams","hooks_url":"https://api.github.com/repos/CatDaVinci/qu-an/hooks","issue_events_url":"https://api.github.com/repos/CatDaVinci/qu-an/issues/events{/number}","events_url":"https://api.github.com/repos/CatDaVinci/qu-an/events","assignees_url":"https://api.github.com/repos/CatDaVinci/qu-an/assignees{/user}","branches_url":"https://api.github.com/repos/CatDaVinci/qu-an/branches{/branch}","tags_url":"https://api.github.com/repos/CatDaVinci/qu-an/tags","blobs_url":"https://api.github.com/repos/CatDaVinci/qu-an/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CatDaVinci/qu-an/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CatDaVinci/qu-an/git/refs{/sha}","trees_url":"https://api.github.com/repos/CatDaVinci/qu-an/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CatDaVinci/qu-an/statuses/{sha}","languages_url":"https://api.github.com/repos/CatDaVinci/qu-an/languages","stargazers_url":"https://api.github.com/repos/CatDaVinci/qu-an/stargazers","contributors_url":"https://api.github.com/repos/CatDaVinci/qu-an/contributors","subscribers_url":"https://api.github.com/repos/CatDaVinci/qu-an/subscribers","subscription_url":"https://api.github.com/repos/CatDaVinci/qu-an/subscription","commits_url":"https://api.github.com/repos/CatDaVinci/qu-an/commits{/sha}","git_commits_url":"https://api.github.com/repos/CatDaVinci/qu-an/git/commits{/sha}","comments_url":"https://api.github.com/repos/CatDaVinci/qu-an/comments{/number}","issue_comment_url":"https://api.github.com/repos/CatDaVinci/qu-an/issues/comments{/number}","contents_url":"https://api.github.com/repos/CatDaVinci/qu-an/contents/{+path}","compare_url":"https://api.github.com/repos/CatDaVinci/qu-an/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CatDaVinci/qu-an/merges","archive_url":"https://api.github.com/repos/CatDaVinci/qu-an/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CatDaVinci/qu-an/downloads","issues_url":"https://api.github.com/repos/CatDaVinci/qu-an/issues{/number}","pulls_url":"https://api.github.com/repos/CatDaVinci/qu-an/pulls{/number}","milestones_url":"https://api.github.com/repos/CatDaVinci/qu-an/milestones{/number}","notifications_url":"https://api.github.com/repos/CatDaVinci/qu-an/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CatDaVinci/qu-an/labels{/name}","releases_url":"https://api.github.com/repos/CatDaVinci/qu-an/releases{/id}","deployments_url":"https://api.github.com/repos/CatDaVinci/qu-an/deployments","created_at":"2016-04-26T11:18:12Z","updated_at":"2016-04-26T11:18:41Z","pushed_at":"2016-05-08T17:46:43Z","git_url":"git://github.com/CatDaVinci/qu-an.git","ssh_url":"git@github.com:CatDaVinci/qu-an.git","clone_url":"https://github.com/CatDaVinci/qu-an.git","svn_url":"https://github.com/CatDaVinci/qu-an","homepage":null,"size":67,"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":"CatDaVinci:master","ref":"master","sha":"7e3ba49e1bb677c1be58951b16241e1c2cb50728","user":{"login":"CatDaVinci","id":9443548,"avatar_url":"https://avatars.githubusercontent.com/u/9443548?v=3","gravatar_id":"","url":"https://api.github.com/users/CatDaVinci","html_url":"https://github.com/CatDaVinci","followers_url":"https://api.github.com/users/CatDaVinci/followers","following_url":"https://api.github.com/users/CatDaVinci/following{/other_user}","gists_url":"https://api.github.com/users/CatDaVinci/gists{/gist_id}","starred_url":"https://api.github.com/users/CatDaVinci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CatDaVinci/subscriptions","organizations_url":"https://api.github.com/users/CatDaVinci/orgs","repos_url":"https://api.github.com/users/CatDaVinci/repos","events_url":"https://api.github.com/users/CatDaVinci/events{/privacy}","received_events_url":"https://api.github.com/users/CatDaVinci/received_events","type":"User","site_admin":false},"repo":{"id":57122142,"name":"qu-an","full_name":"CatDaVinci/qu-an","owner":{"login":"CatDaVinci","id":9443548,"avatar_url":"https://avatars.githubusercontent.com/u/9443548?v=3","gravatar_id":"","url":"https://api.github.com/users/CatDaVinci","html_url":"https://github.com/CatDaVinci","followers_url":"https://api.github.com/users/CatDaVinci/followers","following_url":"https://api.github.com/users/CatDaVinci/following{/other_user}","gists_url":"https://api.github.com/users/CatDaVinci/gists{/gist_id}","starred_url":"https://api.github.com/users/CatDaVinci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CatDaVinci/subscriptions","organizations_url":"https://api.github.com/users/CatDaVinci/orgs","repos_url":"https://api.github.com/users/CatDaVinci/repos","events_url":"https://api.github.com/users/CatDaVinci/events{/privacy}","received_events_url":"https://api.github.com/users/CatDaVinci/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/CatDaVinci/qu-an","description":"rails-course","fork":false,"url":"https://api.github.com/repos/CatDaVinci/qu-an","forks_url":"https://api.github.com/repos/CatDaVinci/qu-an/forks","keys_url":"https://api.github.com/repos/CatDaVinci/qu-an/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CatDaVinci/qu-an/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CatDaVinci/qu-an/teams","hooks_url":"https://api.github.com/repos/CatDaVinci/qu-an/hooks","issue_events_url":"https://api.github.com/repos/CatDaVinci/qu-an/issues/events{/number}","events_url":"https://api.github.com/repos/CatDaVinci/qu-an/events","assignees_url":"https://api.github.com/repos/CatDaVinci/qu-an/assignees{/user}","branches_url":"https://api.github.com/repos/CatDaVinci/qu-an/branches{/branch}","tags_url":"https://api.github.com/repos/CatDaVinci/qu-an/tags","blobs_url":"https://api.github.com/repos/CatDaVinci/qu-an/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CatDaVinci/qu-an/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CatDaVinci/qu-an/git/refs{/sha}","trees_url":"https://api.github.com/repos/CatDaVinci/qu-an/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CatDaVinci/qu-an/statuses/{sha}","languages_url":"https://api.github.com/repos/CatDaVinci/qu-an/languages","stargazers_url":"https://api.github.com/repos/CatDaVinci/qu-an/stargazers","contributors_url":"https://api.github.com/repos/CatDaVinci/qu-an/contributors","subscribers_url":"https://api.github.com/repos/CatDaVinci/qu-an/subscribers","subscription_url":"https://api.github.com/repos/CatDaVinci/qu-an/subscription","commits_url":"https://api.github.com/repos/CatDaVinci/qu-an/commits{/sha}","git_commits_url":"https://api.github.com/repos/CatDaVinci/qu-an/git/commits{/sha}","comments_url":"https://api.github.com/repos/CatDaVinci/qu-an/comments{/number}","issue_comment_url":"https://api.github.com/repos/CatDaVinci/qu-an/issues/comments{/number}","contents_url":"https://api.github.com/repos/CatDaVinci/qu-an/contents/{+path}","compare_url":"https://api.github.com/repos/CatDaVinci/qu-an/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CatDaVinci/qu-an/merges","archive_url":"https://api.github.com/repos/CatDaVinci/qu-an/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CatDaVinci/qu-an/downloads","issues_url":"https://api.github.com/repos/CatDaVinci/qu-an/issues{/number}","pulls_url":"https://api.github.com/repos/CatDaVinci/qu-an/pulls{/number}","milestones_url":"https://api.github.com/repos/CatDaVinci/qu-an/milestones{/number}","notifications_url":"https://api.github.com/repos/CatDaVinci/qu-an/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CatDaVinci/qu-an/labels{/name}","releases_url":"https://api.github.com/repos/CatDaVinci/qu-an/releases{/id}","deployments_url":"https://api.github.com/repos/CatDaVinci/qu-an/deployments","created_at":"2016-04-26T11:18:12Z","updated_at":"2016-04-26T11:18:41Z","pushed_at":"2016-05-08T17:46:43Z","git_url":"git://github.com/CatDaVinci/qu-an.git","ssh_url":"git@github.com:CatDaVinci/qu-an.git","clone_url":"https://github.com/CatDaVinci/qu-an.git","svn_url":"https://github.com/CatDaVinci/qu-an","homepage":null,"size":67,"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/CatDaVinci/qu-an/pulls/3"},"html":{"href":"https://github.com/CatDaVinci/qu-an/pull/3"},"issue":{"href":"https://api.github.com/repos/CatDaVinci/qu-an/issues/3"},"comments":{"href":"https://api.github.com/repos/CatDaVinci/qu-an/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/CatDaVinci/qu-an/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/CatDaVinci/qu-an/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CatDaVinci/qu-an/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/CatDaVinci/qu-an/statuses/da7b0bd4ff3b1c6c615ef1174507c61921266ac8"}}}}