{"action":"created","comment":{"url":"https://api.github.com/repos/bagdenia/qna/pulls/comments/126303456","pull_request_review_id":48776326,"id":126303456,"diff_hunk":"@@ -0,0 +1,41 @@\n+class Ability\n+  include CanCan::Ability\n+\n+  attr_reader :user\n+\n+  def initialize(user)\n+    @user = user\n+    if user\n+      user.admin ? admin_abilities : user_abilities\n+    else\n+      guest_abilities\n+    end\n+  end\n+\n+  def guest_abilities\n+    can :read, :all\n+  end\n+\n+  def admin_abilities\n+    can :manage, :all\n+  end\n+\n+  def user_abilities\n+    guest_abilities\n+    can :create, [Question, Answer, Comment, Attachment]\n+    can :create, Vote do |vote|\n+      vote.votable.user != user\n+    end\n+    can :update, [Question,Answer], user: user\n+    can :set_best, Answer do |answer|\n+      answer.question.user == user","path":"app/models/ability.rb","position":31,"original_position":31,"commit_id":"e21c30885ca7491a90e8082cd5cdd268b09b7cf6","original_commit_id":"e21c30885ca7491a90e8082cd5cdd268b09b7cf6","user":{"login":"vkurennov","id":968537,"avatar_url":"https://avatars0.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":"Сравнивай по user_id","created_at":"2017-07-09T12:36:07Z","updated_at":"2017-07-09T12:36:26Z","html_url":"https://github.com/bagdenia/qna/pull/13#discussion_r126303456","pull_request_url":"https://api.github.com/repos/bagdenia/qna/pulls/13","_links":{"self":{"href":"https://api.github.com/repos/bagdenia/qna/pulls/comments/126303456"},"html":{"href":"https://github.com/bagdenia/qna/pull/13#discussion_r126303456"},"pull_request":{"href":"https://api.github.com/repos/bagdenia/qna/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/bagdenia/qna/pulls/13","id":129538899,"html_url":"https://github.com/bagdenia/qna/pull/13","diff_url":"https://github.com/bagdenia/qna/pull/13.diff","patch_url":"https://github.com/bagdenia/qna/pull/13.patch","issue_url":"https://api.github.com/repos/bagdenia/qna/issues/13","number":13,"state":"open","locked":false,"title":"Cancan adopted authorization","user":{"login":"bagdenia","id":20929846,"avatar_url":"https://avatars2.githubusercontent.com/u/20929846?v=3","gravatar_id":"","url":"https://api.github.com/users/bagdenia","html_url":"https://github.com/bagdenia","followers_url":"https://api.github.com/users/bagdenia/followers","following_url":"https://api.github.com/users/bagdenia/following{/other_user}","gists_url":"https://api.github.com/users/bagdenia/gists{/gist_id}","starred_url":"https://api.github.com/users/bagdenia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bagdenia/subscriptions","organizations_url":"https://api.github.com/users/bagdenia/orgs","repos_url":"https://api.github.com/users/bagdenia/repos","events_url":"https://api.github.com/users/bagdenia/events{/privacy}","received_events_url":"https://api.github.com/users/bagdenia/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-07-08T19:02:58Z","updated_at":"2017-07-09T12:36:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"29e3ccc4378a86836cada74583ad90f7c425b3fd","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/bagdenia/qna/pulls/13/commits","review_comments_url":"https://api.github.com/repos/bagdenia/qna/pulls/13/comments","review_comment_url":"https://api.github.com/repos/bagdenia/qna/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bagdenia/qna/issues/13/comments","statuses_url":"https://api.github.com/repos/bagdenia/qna/statuses/e21c30885ca7491a90e8082cd5cdd268b09b7cf6","head":{"label":"bagdenia:lesson13","ref":"lesson13","sha":"e21c30885ca7491a90e8082cd5cdd268b09b7cf6","user":{"login":"bagdenia","id":20929846,"avatar_url":"https://avatars2.githubusercontent.com/u/20929846?v=3","gravatar_id":"","url":"https://api.github.com/users/bagdenia","html_url":"https://github.com/bagdenia","followers_url":"https://api.github.com/users/bagdenia/followers","following_url":"https://api.github.com/users/bagdenia/following{/other_user}","gists_url":"https://api.github.com/users/bagdenia/gists{/gist_id}","starred_url":"https://api.github.com/users/bagdenia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bagdenia/subscriptions","organizations_url":"https://api.github.com/users/bagdenia/orgs","repos_url":"https://api.github.com/users/bagdenia/repos","events_url":"https://api.github.com/users/bagdenia/events{/privacy}","received_events_url":"https://api.github.com/users/bagdenia/received_events","type":"User","site_admin":false},"repo":{"id":91580938,"name":"qna","full_name":"bagdenia/qna","owner":{"login":"bagdenia","id":20929846,"avatar_url":"https://avatars2.githubusercontent.com/u/20929846?v=3","gravatar_id":"","url":"https://api.github.com/users/bagdenia","html_url":"https://github.com/bagdenia","followers_url":"https://api.github.com/users/bagdenia/followers","following_url":"https://api.github.com/users/bagdenia/following{/other_user}","gists_url":"https://api.github.com/users/bagdenia/gists{/gist_id}","starred_url":"https://api.github.com/users/bagdenia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bagdenia/subscriptions","organizations_url":"https://api.github.com/users/bagdenia/orgs","repos_url":"https://api.github.com/users/bagdenia/repos","events_url":"https://api.github.com/users/bagdenia/events{/privacy}","received_events_url":"https://api.github.com/users/bagdenia/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bagdenia/qna","description":null,"fork":false,"url":"https://api.github.com/repos/bagdenia/qna","forks_url":"https://api.github.com/repos/bagdenia/qna/forks","keys_url":"https://api.github.com/repos/bagdenia/qna/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bagdenia/qna/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bagdenia/qna/teams","hooks_url":"https://api.github.com/repos/bagdenia/qna/hooks","issue_events_url":"https://api.github.com/repos/bagdenia/qna/issues/events{/number}","events_url":"https://api.github.com/repos/bagdenia/qna/events","assignees_url":"https://api.github.com/repos/bagdenia/qna/assignees{/user}","branches_url":"https://api.github.com/repos/bagdenia/qna/branches{/branch}","tags_url":"https://api.github.com/repos/bagdenia/qna/tags","blobs_url":"https://api.github.com/repos/bagdenia/qna/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bagdenia/qna/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bagdenia/qna/git/refs{/sha}","trees_url":"https://api.github.com/repos/bagdenia/qna/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bagdenia/qna/statuses/{sha}","languages_url":"https://api.github.com/repos/bagdenia/qna/languages","stargazers_url":"https://api.github.com/repos/bagdenia/qna/stargazers","contributors_url":"https://api.github.com/repos/bagdenia/qna/contributors","subscribers_url":"https://api.github.com/repos/bagdenia/qna/subscribers","subscription_url":"https://api.github.com/repos/bagdenia/qna/subscription","commits_url":"https://api.github.com/repos/bagdenia/qna/commits{/sha}","git_commits_url":"https://api.github.com/repos/bagdenia/qna/git/commits{/sha}","comments_url":"https://api.github.com/repos/bagdenia/qna/comments{/number}","issue_comment_url":"https://api.github.com/repos/bagdenia/qna/issues/comments{/number}","contents_url":"https://api.github.com/repos/bagdenia/qna/contents/{+path}","compare_url":"https://api.github.com/repos/bagdenia/qna/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bagdenia/qna/merges","archive_url":"https://api.github.com/repos/bagdenia/qna/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bagdenia/qna/downloads","issues_url":"https://api.github.com/repos/bagdenia/qna/issues{/number}","pulls_url":"https://api.github.com/repos/bagdenia/qna/pulls{/number}","milestones_url":"https://api.github.com/repos/bagdenia/qna/milestones{/number}","notifications_url":"https://api.github.com/repos/bagdenia/qna/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bagdenia/qna/labels{/name}","releases_url":"https://api.github.com/repos/bagdenia/qna/releases{/id}","deployments_url":"https://api.github.com/repos/bagdenia/qna/deployments","created_at":"2017-05-17T13:41:54Z","updated_at":"2017-05-17T13:43:12Z","pushed_at":"2017-07-08T19:02:58Z","git_url":"git://github.com/bagdenia/qna.git","ssh_url":"git@github.com:bagdenia/qna.git","clone_url":"https://github.com/bagdenia/qna.git","svn_url":"https://github.com/bagdenia/qna","homepage":null,"size":1820,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":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":"bagdenia:master","ref":"master","sha":"9e0fcbaeb46cfe88ae2c1881f37914a351be16bf","user":{"login":"bagdenia","id":20929846,"avatar_url":"https://avatars2.githubusercontent.com/u/20929846?v=3","gravatar_id":"","url":"https://api.github.com/users/bagdenia","html_url":"https://github.com/bagdenia","followers_url":"https://api.github.com/users/bagdenia/followers","following_url":"https://api.github.com/users/bagdenia/following{/other_user}","gists_url":"https://api.github.com/users/bagdenia/gists{/gist_id}","starred_url":"https://api.github.com/users/bagdenia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bagdenia/subscriptions","organizations_url":"https://api.github.com/users/bagdenia/orgs","repos_url":"https://api.github.com/users/bagdenia/repos","events_url":"https://api.github.com/users/bagdenia/events{/privacy}","received_events_url":"https://api.github.com/users/bagdenia/received_events","type":"User","site_admin":false},"repo":{"id":91580938,"name":"qna","full_name":"bagdenia/qna","owner":{"login":"bagdenia","id":20929846,"avatar_url":"https://avatars2.githubusercontent.com/u/20929846?v=3","gravatar_id":"","url":"https://api.github.com/users/bagdenia","html_url":"https://github.com/bagdenia","followers_url":"https://api.github.com/users/bagdenia/followers","following_url":"https://api.github.com/users/bagdenia/following{/other_user}","gists_url":"https://api.github.com/users/bagdenia/gists{/gist_id}","starred_url":"https://api.github.com/users/bagdenia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bagdenia/subscriptions","organizations_url":"https://api.github.com/users/bagdenia/orgs","repos_url":"https://api.github.com/users/bagdenia/repos","events_url":"https://api.github.com/users/bagdenia/events{/privacy}","received_events_url":"https://api.github.com/users/bagdenia/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bagdenia/qna","description":null,"fork":false,"url":"https://api.github.com/repos/bagdenia/qna","forks_url":"https://api.github.com/repos/bagdenia/qna/forks","keys_url":"https://api.github.com/repos/bagdenia/qna/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bagdenia/qna/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bagdenia/qna/teams","hooks_url":"https://api.github.com/repos/bagdenia/qna/hooks","issue_events_url":"https://api.github.com/repos/bagdenia/qna/issues/events{/number}","events_url":"https://api.github.com/repos/bagdenia/qna/events","assignees_url":"https://api.github.com/repos/bagdenia/qna/assignees{/user}","branches_url":"https://api.github.com/repos/bagdenia/qna/branches{/branch}","tags_url":"https://api.github.com/repos/bagdenia/qna/tags","blobs_url":"https://api.github.com/repos/bagdenia/qna/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bagdenia/qna/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bagdenia/qna/git/refs{/sha}","trees_url":"https://api.github.com/repos/bagdenia/qna/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bagdenia/qna/statuses/{sha}","languages_url":"https://api.github.com/repos/bagdenia/qna/languages","stargazers_url":"https://api.github.com/repos/bagdenia/qna/stargazers","contributors_url":"https://api.github.com/repos/bagdenia/qna/contributors","subscribers_url":"https://api.github.com/repos/bagdenia/qna/subscribers","subscription_url":"https://api.github.com/repos/bagdenia/qna/subscription","commits_url":"https://api.github.com/repos/bagdenia/qna/commits{/sha}","git_commits_url":"https://api.github.com/repos/bagdenia/qna/git/commits{/sha}","comments_url":"https://api.github.com/repos/bagdenia/qna/comments{/number}","issue_comment_url":"https://api.github.com/repos/bagdenia/qna/issues/comments{/number}","contents_url":"https://api.github.com/repos/bagdenia/qna/contents/{+path}","compare_url":"https://api.github.com/repos/bagdenia/qna/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bagdenia/qna/merges","archive_url":"https://api.github.com/repos/bagdenia/qna/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bagdenia/qna/downloads","issues_url":"https://api.github.com/repos/bagdenia/qna/issues{/number}","pulls_url":"https://api.github.com/repos/bagdenia/qna/pulls{/number}","milestones_url":"https://api.github.com/repos/bagdenia/qna/milestones{/number}","notifications_url":"https://api.github.com/repos/bagdenia/qna/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bagdenia/qna/labels{/name}","releases_url":"https://api.github.com/repos/bagdenia/qna/releases{/id}","deployments_url":"https://api.github.com/repos/bagdenia/qna/deployments","created_at":"2017-05-17T13:41:54Z","updated_at":"2017-05-17T13:43:12Z","pushed_at":"2017-07-08T19:02:58Z","git_url":"git://github.com/bagdenia/qna.git","ssh_url":"git@github.com:bagdenia/qna.git","clone_url":"https://github.com/bagdenia/qna.git","svn_url":"https://github.com/bagdenia/qna","homepage":null,"size":1820,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":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/bagdenia/qna/pulls/13"},"html":{"href":"https://github.com/bagdenia/qna/pull/13"},"issue":{"href":"https://api.github.com/repos/bagdenia/qna/issues/13"},"comments":{"href":"https://api.github.com/repos/bagdenia/qna/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/bagdenia/qna/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/bagdenia/qna/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bagdenia/qna/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/bagdenia/qna/statuses/e21c30885ca7491a90e8082cd5cdd268b09b7cf6"}}}}
{"actor":{"display_login":"vkurennov"}}