{"action":"created","comment":{"url":"https://api.github.com/repos/one0fnine/QnA/pulls/comments/65879039","id":65879039,"diff_hunk":"@@ -0,0 +1,11 @@\n+class Rating < ActiveRecord::Base\n+  belongs_to :ratingable, polymorphic: true\n+  belongs_to :user\n+\n+  validates :user_id, presence: true\n+  validates :voice, presence: true, numericality: { only_integer: true }\n+\n+  def self.summation","path":"app/models/rating.rb","position":8,"original_position":8,"commit_id":"95c98b30d5438da3f61ccc8cefda503301331fce","original_commit_id":"95c98b30d5438da3f61ccc8cefda503301331fce","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":"Это нужно сделать через именованый скоуп, тогда можно будет и у всей модели вызывать и у коллекции","created_at":"2016-06-06T12:08:00Z","updated_at":"2016-06-06T12:08:00Z","html_url":"https://github.com/one0fnine/QnA/pull/7#discussion_r65879039","pull_request_url":"https://api.github.com/repos/one0fnine/QnA/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/one0fnine/QnA/pulls/comments/65879039"},"html":{"href":"https://github.com/one0fnine/QnA/pull/7#discussion_r65879039"},"pull_request":{"href":"https://api.github.com/repos/one0fnine/QnA/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/one0fnine/QnA/pulls/7","id":72463085,"html_url":"https://github.com/one0fnine/QnA/pull/7","diff_url":"https://github.com/one0fnine/QnA/pull/7.diff","patch_url":"https://github.com/one0fnine/QnA/pull/7.patch","issue_url":"https://api.github.com/repos/one0fnine/QnA/issues/7","number":7,"state":"open","locked":false,"title":"feature/json ajax answer","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-06-03T07:10:50Z","updated_at":"2016-06-06T12:08:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8c2e1a8c750b8612bb972c0ec185c0ec73debf60","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/one0fnine/QnA/pulls/7/commits","review_comments_url":"https://api.github.com/repos/one0fnine/QnA/pulls/7/comments","review_comment_url":"https://api.github.com/repos/one0fnine/QnA/pulls/comments{/number}","comments_url":"https://api.github.com/repos/one0fnine/QnA/issues/7/comments","statuses_url":"https://api.github.com/repos/one0fnine/QnA/statuses/95c98b30d5438da3f61ccc8cefda503301331fce","head":{"label":"one0fnine:feature/json_ajax_answer","ref":"feature/json_ajax_answer","sha":"95c98b30d5438da3f61ccc8cefda503301331fce","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-06-06T07:29:52Z","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":184,"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":"eb40bbdd6e331a7fd3d58cd8378cc04c21b7c87d","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-06-06T07:29:52Z","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":184,"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/7"},"html":{"href":"https://github.com/one0fnine/QnA/pull/7"},"issue":{"href":"https://api.github.com/repos/one0fnine/QnA/issues/7"},"comments":{"href":"https://api.github.com/repos/one0fnine/QnA/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/one0fnine/QnA/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/one0fnine/QnA/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/one0fnine/QnA/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/one0fnine/QnA/statuses/95c98b30d5438da3f61ccc8cefda503301331fce"}}}}
{"actor":{"display_login":"vkurennov"}}