{"action":"created","comment":{"url":"https://api.github.com/repos/Bazih/example/pulls/comments/35317502","id":35317502,"diff_hunk":"@@ -0,0 +1,27 @@\n+require 'active_support/concern'\n+\n+module Votable\n+  extend ActiveSupport::Concern\n+\n+  included do\n+    has_many :votes, dependent: :delete_all, as: :votable\n+  end\n+\n+  def make_vote(user, value)\n+    vote = votes.find_or_initialize_by(user: user)\n+    vote.update(value: value)\n+  end\n+\n+  def voted_by?(user, value = [-1, 1])","path":"app/models/concerns/votable.rb","position":15,"original_position":15,"commit_id":"f3b6d39877e3825dc5e6c0fc80f64d8dd63fb3e0","original_commit_id":"f3b6d39877e3825dc5e6c0fc80f64d8dd63fb3e0","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":"А зачем нужен параметр value? Можно ведь его не указывать и просто найти голоса пользователя за объект","created_at":"2015-07-23T12:53:03Z","updated_at":"2015-07-23T12:53:03Z","html_url":"https://github.com/Bazih/example/pull/7#discussion_r35317502","pull_request_url":"https://api.github.com/repos/Bazih/example/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/Bazih/example/pulls/comments/35317502"},"html":{"href":"https://github.com/Bazih/example/pull/7#discussion_r35317502"},"pull_request":{"href":"https://api.github.com/repos/Bazih/example/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/Bazih/example/pulls/7","id":40614714,"html_url":"https://github.com/Bazih/example/pull/7","diff_url":"https://github.com/Bazih/example/pull/7.diff","patch_url":"https://github.com/Bazih/example/pull/7.patch","issue_url":"https://api.github.com/repos/Bazih/example/issues/7","number":7,"state":"open","locked":false,"title":"Lesson 9","user":{"login":"Bazih","id":1028361,"avatar_url":"https://avatars.githubusercontent.com/u/1028361?v=3","gravatar_id":"","url":"https://api.github.com/users/Bazih","html_url":"https://github.com/Bazih","followers_url":"https://api.github.com/users/Bazih/followers","following_url":"https://api.github.com/users/Bazih/following{/other_user}","gists_url":"https://api.github.com/users/Bazih/gists{/gist_id}","starred_url":"https://api.github.com/users/Bazih/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bazih/subscriptions","organizations_url":"https://api.github.com/users/Bazih/orgs","repos_url":"https://api.github.com/users/Bazih/repos","events_url":"https://api.github.com/users/Bazih/events{/privacy}","received_events_url":"https://api.github.com/users/Bazih/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-07-22T21:37:20Z","updated_at":"2015-07-23T12:53:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"818c3edb7b0c3edd2a9a90cd772149d48bc7c6df","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Bazih/example/pulls/7/commits","review_comments_url":"https://api.github.com/repos/Bazih/example/pulls/7/comments","review_comment_url":"https://api.github.com/repos/Bazih/example/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Bazih/example/issues/7/comments","statuses_url":"https://api.github.com/repos/Bazih/example/statuses/f3b6d39877e3825dc5e6c0fc80f64d8dd63fb3e0","head":{"label":"Bazih:lesson-9","ref":"lesson-9","sha":"f3b6d39877e3825dc5e6c0fc80f64d8dd63fb3e0","user":{"login":"Bazih","id":1028361,"avatar_url":"https://avatars.githubusercontent.com/u/1028361?v=3","gravatar_id":"","url":"https://api.github.com/users/Bazih","html_url":"https://github.com/Bazih","followers_url":"https://api.github.com/users/Bazih/followers","following_url":"https://api.github.com/users/Bazih/following{/other_user}","gists_url":"https://api.github.com/users/Bazih/gists{/gist_id}","starred_url":"https://api.github.com/users/Bazih/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bazih/subscriptions","organizations_url":"https://api.github.com/users/Bazih/orgs","repos_url":"https://api.github.com/users/Bazih/repos","events_url":"https://api.github.com/users/Bazih/events{/privacy}","received_events_url":"https://api.github.com/users/Bazih/received_events","type":"User","site_admin":false},"repo":{"id":36601695,"name":"example","full_name":"Bazih/example","owner":{"login":"Bazih","id":1028361,"avatar_url":"https://avatars.githubusercontent.com/u/1028361?v=3","gravatar_id":"","url":"https://api.github.com/users/Bazih","html_url":"https://github.com/Bazih","followers_url":"https://api.github.com/users/Bazih/followers","following_url":"https://api.github.com/users/Bazih/following{/other_user}","gists_url":"https://api.github.com/users/Bazih/gists{/gist_id}","starred_url":"https://api.github.com/users/Bazih/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bazih/subscriptions","organizations_url":"https://api.github.com/users/Bazih/orgs","repos_url":"https://api.github.com/users/Bazih/repos","events_url":"https://api.github.com/users/Bazih/events{/privacy}","received_events_url":"https://api.github.com/users/Bazih/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Bazih/example","description":"","fork":false,"url":"https://api.github.com/repos/Bazih/example","forks_url":"https://api.github.com/repos/Bazih/example/forks","keys_url":"https://api.github.com/repos/Bazih/example/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Bazih/example/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Bazih/example/teams","hooks_url":"https://api.github.com/repos/Bazih/example/hooks","issue_events_url":"https://api.github.com/repos/Bazih/example/issues/events{/number}","events_url":"https://api.github.com/repos/Bazih/example/events","assignees_url":"https://api.github.com/repos/Bazih/example/assignees{/user}","branches_url":"https://api.github.com/repos/Bazih/example/branches{/branch}","tags_url":"https://api.github.com/repos/Bazih/example/tags","blobs_url":"https://api.github.com/repos/Bazih/example/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Bazih/example/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Bazih/example/git/refs{/sha}","trees_url":"https://api.github.com/repos/Bazih/example/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Bazih/example/statuses/{sha}","languages_url":"https://api.github.com/repos/Bazih/example/languages","stargazers_url":"https://api.github.com/repos/Bazih/example/stargazers","contributors_url":"https://api.github.com/repos/Bazih/example/contributors","subscribers_url":"https://api.github.com/repos/Bazih/example/subscribers","subscription_url":"https://api.github.com/repos/Bazih/example/subscription","commits_url":"https://api.github.com/repos/Bazih/example/commits{/sha}","git_commits_url":"https://api.github.com/repos/Bazih/example/git/commits{/sha}","comments_url":"https://api.github.com/repos/Bazih/example/comments{/number}","issue_comment_url":"https://api.github.com/repos/Bazih/example/issues/comments{/number}","contents_url":"https://api.github.com/repos/Bazih/example/contents/{+path}","compare_url":"https://api.github.com/repos/Bazih/example/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Bazih/example/merges","archive_url":"https://api.github.com/repos/Bazih/example/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Bazih/example/downloads","issues_url":"https://api.github.com/repos/Bazih/example/issues{/number}","pulls_url":"https://api.github.com/repos/Bazih/example/pulls{/number}","milestones_url":"https://api.github.com/repos/Bazih/example/milestones{/number}","notifications_url":"https://api.github.com/repos/Bazih/example/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Bazih/example/labels{/name}","releases_url":"https://api.github.com/repos/Bazih/example/releases{/id}","created_at":"2015-05-31T12:18:31Z","updated_at":"2015-05-31T12:20:52Z","pushed_at":"2015-07-22T21:37:21Z","git_url":"git://github.com/Bazih/example.git","ssh_url":"git@github.com:Bazih/example.git","clone_url":"https://github.com/Bazih/example.git","svn_url":"https://github.com/Bazih/example","homepage":null,"size":384,"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":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"Bazih:master","ref":"master","sha":"f0ba70306dc4d3131446d9f43ea061fe9e384935","user":{"login":"Bazih","id":1028361,"avatar_url":"https://avatars.githubusercontent.com/u/1028361?v=3","gravatar_id":"","url":"https://api.github.com/users/Bazih","html_url":"https://github.com/Bazih","followers_url":"https://api.github.com/users/Bazih/followers","following_url":"https://api.github.com/users/Bazih/following{/other_user}","gists_url":"https://api.github.com/users/Bazih/gists{/gist_id}","starred_url":"https://api.github.com/users/Bazih/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bazih/subscriptions","organizations_url":"https://api.github.com/users/Bazih/orgs","repos_url":"https://api.github.com/users/Bazih/repos","events_url":"https://api.github.com/users/Bazih/events{/privacy}","received_events_url":"https://api.github.com/users/Bazih/received_events","type":"User","site_admin":false},"repo":{"id":36601695,"name":"example","full_name":"Bazih/example","owner":{"login":"Bazih","id":1028361,"avatar_url":"https://avatars.githubusercontent.com/u/1028361?v=3","gravatar_id":"","url":"https://api.github.com/users/Bazih","html_url":"https://github.com/Bazih","followers_url":"https://api.github.com/users/Bazih/followers","following_url":"https://api.github.com/users/Bazih/following{/other_user}","gists_url":"https://api.github.com/users/Bazih/gists{/gist_id}","starred_url":"https://api.github.com/users/Bazih/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bazih/subscriptions","organizations_url":"https://api.github.com/users/Bazih/orgs","repos_url":"https://api.github.com/users/Bazih/repos","events_url":"https://api.github.com/users/Bazih/events{/privacy}","received_events_url":"https://api.github.com/users/Bazih/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Bazih/example","description":"","fork":false,"url":"https://api.github.com/repos/Bazih/example","forks_url":"https://api.github.com/repos/Bazih/example/forks","keys_url":"https://api.github.com/repos/Bazih/example/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Bazih/example/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Bazih/example/teams","hooks_url":"https://api.github.com/repos/Bazih/example/hooks","issue_events_url":"https://api.github.com/repos/Bazih/example/issues/events{/number}","events_url":"https://api.github.com/repos/Bazih/example/events","assignees_url":"https://api.github.com/repos/Bazih/example/assignees{/user}","branches_url":"https://api.github.com/repos/Bazih/example/branches{/branch}","tags_url":"https://api.github.com/repos/Bazih/example/tags","blobs_url":"https://api.github.com/repos/Bazih/example/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Bazih/example/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Bazih/example/git/refs{/sha}","trees_url":"https://api.github.com/repos/Bazih/example/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Bazih/example/statuses/{sha}","languages_url":"https://api.github.com/repos/Bazih/example/languages","stargazers_url":"https://api.github.com/repos/Bazih/example/stargazers","contributors_url":"https://api.github.com/repos/Bazih/example/contributors","subscribers_url":"https://api.github.com/repos/Bazih/example/subscribers","subscription_url":"https://api.github.com/repos/Bazih/example/subscription","commits_url":"https://api.github.com/repos/Bazih/example/commits{/sha}","git_commits_url":"https://api.github.com/repos/Bazih/example/git/commits{/sha}","comments_url":"https://api.github.com/repos/Bazih/example/comments{/number}","issue_comment_url":"https://api.github.com/repos/Bazih/example/issues/comments{/number}","contents_url":"https://api.github.com/repos/Bazih/example/contents/{+path}","compare_url":"https://api.github.com/repos/Bazih/example/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Bazih/example/merges","archive_url":"https://api.github.com/repos/Bazih/example/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Bazih/example/downloads","issues_url":"https://api.github.com/repos/Bazih/example/issues{/number}","pulls_url":"https://api.github.com/repos/Bazih/example/pulls{/number}","milestones_url":"https://api.github.com/repos/Bazih/example/milestones{/number}","notifications_url":"https://api.github.com/repos/Bazih/example/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Bazih/example/labels{/name}","releases_url":"https://api.github.com/repos/Bazih/example/releases{/id}","created_at":"2015-05-31T12:18:31Z","updated_at":"2015-05-31T12:20:52Z","pushed_at":"2015-07-22T21:37:21Z","git_url":"git://github.com/Bazih/example.git","ssh_url":"git@github.com:Bazih/example.git","clone_url":"https://github.com/Bazih/example.git","svn_url":"https://github.com/Bazih/example","homepage":null,"size":384,"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":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Bazih/example/pulls/7"},"html":{"href":"https://github.com/Bazih/example/pull/7"},"issue":{"href":"https://api.github.com/repos/Bazih/example/issues/7"},"comments":{"href":"https://api.github.com/repos/Bazih/example/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/Bazih/example/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/Bazih/example/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Bazih/example/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/Bazih/example/statuses/f3b6d39877e3825dc5e6c0fc80f64d8dd63fb3e0"}}}}