{"action":"created","comment":{"url":"https://api.github.com/repos/npauzenga/Bloccit/pulls/comments/43076022","id":43076022,"diff_hunk":"@@ -24,4 +24,15 @@ def favorited(post)\n   def voted(post)\n     votes.find_by(post_id: post.id)\n   end\n+\n+  def self.top_rated\n+  self.select(\"users.*\") # Select all attributes of the user\n+      .select(\"COUNT(DISTINCT comments.id) AS comments_count\") # Count the comments made by the user\n+      .select(\"COUNT(DISTINCT posts.id) AS posts_count\") # Count the posts made by the user\n+      .select(\"COUNT(DISTINCT comments.id) + COUNT(DISTINCT posts.id) AS rank\") # Add the comment count to the post count and label the sum as \"rank\"\n+      .joins(:posts) # Ties the posts table to the users table, via the user_id\n+      .joins(:comments) # Ties the comments table to the users table, via the user_id\n+      .group(\"users.id\") # Instructs the database to group the results so that each user will be returned in a distinct row\n+      .order(\"rank DESC\") # Instructs the database to order the results in descending order, by the rank that we created in this query. (rank = comment count + post count)","path":"app/models/user.rb","position":13,"original_position":13,"commit_id":"b9cdfe7d420574ae6cd27a5470d7b5fab02ea337","original_commit_id":"b9cdfe7d420574ae6cd27a5470d7b5fab02ea337","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Line is too long. [171/80]<br>Place the . on the previous line, together with the method call receiver.<br>Use 2 (not 4) spaces for indenting an expression spanning multiple lines.","created_at":"2015-10-27T01:33:39Z","updated_at":"2015-10-27T01:33:39Z","html_url":"https://github.com/npauzenga/Bloccit/pull/26#discussion_r43076022","pull_request_url":"https://api.github.com/repos/npauzenga/Bloccit/pulls/26","_links":{"self":{"href":"https://api.github.com/repos/npauzenga/Bloccit/pulls/comments/43076022"},"html":{"href":"https://github.com/npauzenga/Bloccit/pull/26#discussion_r43076022"},"pull_request":{"href":"https://api.github.com/repos/npauzenga/Bloccit/pulls/26"}}},"pull_request":{"url":"https://api.github.com/repos/npauzenga/Bloccit/pulls/26","id":48008507,"html_url":"https://github.com/npauzenga/Bloccit/pull/26","diff_url":"https://github.com/npauzenga/Bloccit/pull/26.diff","patch_url":"https://github.com/npauzenga/Bloccit/pull/26.patch","issue_url":"https://api.github.com/repos/npauzenga/Bloccit/issues/26","number":26,"state":"open","locked":false,"title":"Checkpoint 54 PublicProfiles","user":{"login":"npauzenga","id":5838826,"avatar_url":"https://avatars.githubusercontent.com/u/5838826?v=3","gravatar_id":"","url":"https://api.github.com/users/npauzenga","html_url":"https://github.com/npauzenga","followers_url":"https://api.github.com/users/npauzenga/followers","following_url":"https://api.github.com/users/npauzenga/following{/other_user}","gists_url":"https://api.github.com/users/npauzenga/gists{/gist_id}","starred_url":"https://api.github.com/users/npauzenga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/npauzenga/subscriptions","organizations_url":"https://api.github.com/users/npauzenga/orgs","repos_url":"https://api.github.com/users/npauzenga/repos","events_url":"https://api.github.com/users/npauzenga/events{/privacy}","received_events_url":"https://api.github.com/users/npauzenga/received_events","type":"User","site_admin":false},"body":"Hey @Enriikke! Would you mind taking a look at this? I’m a little stumped. The last section of the checkpoint has us scope the displayed posts to the `current_user`. In the browser it seems to work fine. I can create a post as an authenticated user, sign out, and view the post on that user’s page. The test, however, isn’t passing. It’s getting hung up on the `@post.title`. The issue is associated with the `visible_to(current_user)` scope but I’m not quite seeing where I went wrong…","created_at":"2015-10-18T13:34:01Z","updated_at":"2015-10-27T01:33:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"37cf494685695d05b5ade5cfa2268a55ee493e2c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/npauzenga/Bloccit/pulls/26/commits","review_comments_url":"https://api.github.com/repos/npauzenga/Bloccit/pulls/26/comments","review_comment_url":"https://api.github.com/repos/npauzenga/Bloccit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/npauzenga/Bloccit/issues/26/comments","statuses_url":"https://api.github.com/repos/npauzenga/Bloccit/statuses/b9cdfe7d420574ae6cd27a5470d7b5fab02ea337","head":{"label":"npauzenga:checkpoint-54-PublicProfiles","ref":"checkpoint-54-PublicProfiles","sha":"b9cdfe7d420574ae6cd27a5470d7b5fab02ea337","user":{"login":"npauzenga","id":5838826,"avatar_url":"https://avatars.githubusercontent.com/u/5838826?v=3","gravatar_id":"","url":"https://api.github.com/users/npauzenga","html_url":"https://github.com/npauzenga","followers_url":"https://api.github.com/users/npauzenga/followers","following_url":"https://api.github.com/users/npauzenga/following{/other_user}","gists_url":"https://api.github.com/users/npauzenga/gists{/gist_id}","starred_url":"https://api.github.com/users/npauzenga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/npauzenga/subscriptions","organizations_url":"https://api.github.com/users/npauzenga/orgs","repos_url":"https://api.github.com/users/npauzenga/repos","events_url":"https://api.github.com/users/npauzenga/events{/privacy}","received_events_url":"https://api.github.com/users/npauzenga/received_events","type":"User","site_admin":false},"repo":{"id":43097275,"name":"Bloccit","full_name":"npauzenga/Bloccit","owner":{"login":"npauzenga","id":5838826,"avatar_url":"https://avatars.githubusercontent.com/u/5838826?v=3","gravatar_id":"","url":"https://api.github.com/users/npauzenga","html_url":"https://github.com/npauzenga","followers_url":"https://api.github.com/users/npauzenga/followers","following_url":"https://api.github.com/users/npauzenga/following{/other_user}","gists_url":"https://api.github.com/users/npauzenga/gists{/gist_id}","starred_url":"https://api.github.com/users/npauzenga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/npauzenga/subscriptions","organizations_url":"https://api.github.com/users/npauzenga/orgs","repos_url":"https://api.github.com/users/npauzenga/repos","events_url":"https://api.github.com/users/npauzenga/events{/privacy}","received_events_url":"https://api.github.com/users/npauzenga/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/npauzenga/Bloccit","description":"A Reddit replica for educational purposes","fork":false,"url":"https://api.github.com/repos/npauzenga/Bloccit","forks_url":"https://api.github.com/repos/npauzenga/Bloccit/forks","keys_url":"https://api.github.com/repos/npauzenga/Bloccit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/npauzenga/Bloccit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/npauzenga/Bloccit/teams","hooks_url":"https://api.github.com/repos/npauzenga/Bloccit/hooks","issue_events_url":"https://api.github.com/repos/npauzenga/Bloccit/issues/events{/number}","events_url":"https://api.github.com/repos/npauzenga/Bloccit/events","assignees_url":"https://api.github.com/repos/npauzenga/Bloccit/assignees{/user}","branches_url":"https://api.github.com/repos/npauzenga/Bloccit/branches{/branch}","tags_url":"https://api.github.com/repos/npauzenga/Bloccit/tags","blobs_url":"https://api.github.com/repos/npauzenga/Bloccit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/npauzenga/Bloccit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/npauzenga/Bloccit/git/refs{/sha}","trees_url":"https://api.github.com/repos/npauzenga/Bloccit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/npauzenga/Bloccit/statuses/{sha}","languages_url":"https://api.github.com/repos/npauzenga/Bloccit/languages","stargazers_url":"https://api.github.com/repos/npauzenga/Bloccit/stargazers","contributors_url":"https://api.github.com/repos/npauzenga/Bloccit/contributors","subscribers_url":"https://api.github.com/repos/npauzenga/Bloccit/subscribers","subscription_url":"https://api.github.com/repos/npauzenga/Bloccit/subscription","commits_url":"https://api.github.com/repos/npauzenga/Bloccit/commits{/sha}","git_commits_url":"https://api.github.com/repos/npauzenga/Bloccit/git/commits{/sha}","comments_url":"https://api.github.com/repos/npauzenga/Bloccit/comments{/number}","issue_comment_url":"https://api.github.com/repos/npauzenga/Bloccit/issues/comments{/number}","contents_url":"https://api.github.com/repos/npauzenga/Bloccit/contents/{+path}","compare_url":"https://api.github.com/repos/npauzenga/Bloccit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/npauzenga/Bloccit/merges","archive_url":"https://api.github.com/repos/npauzenga/Bloccit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/npauzenga/Bloccit/downloads","issues_url":"https://api.github.com/repos/npauzenga/Bloccit/issues{/number}","pulls_url":"https://api.github.com/repos/npauzenga/Bloccit/pulls{/number}","milestones_url":"https://api.github.com/repos/npauzenga/Bloccit/milestones{/number}","notifications_url":"https://api.github.com/repos/npauzenga/Bloccit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/npauzenga/Bloccit/labels{/name}","releases_url":"https://api.github.com/repos/npauzenga/Bloccit/releases{/id}","created_at":"2015-09-24T22:52:13Z","updated_at":"2015-09-24T22:53:39Z","pushed_at":"2015-10-27T01:33:33Z","git_url":"git://github.com/npauzenga/Bloccit.git","ssh_url":"git@github.com:npauzenga/Bloccit.git","clone_url":"https://github.com/npauzenga/Bloccit.git","svn_url":"https://github.com/npauzenga/Bloccit","homepage":null,"size":1028,"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":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"base":{"label":"npauzenga:master","ref":"master","sha":"b78637f6075a0800ae1f561abfa41dd6e635d30e","user":{"login":"npauzenga","id":5838826,"avatar_url":"https://avatars.githubusercontent.com/u/5838826?v=3","gravatar_id":"","url":"https://api.github.com/users/npauzenga","html_url":"https://github.com/npauzenga","followers_url":"https://api.github.com/users/npauzenga/followers","following_url":"https://api.github.com/users/npauzenga/following{/other_user}","gists_url":"https://api.github.com/users/npauzenga/gists{/gist_id}","starred_url":"https://api.github.com/users/npauzenga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/npauzenga/subscriptions","organizations_url":"https://api.github.com/users/npauzenga/orgs","repos_url":"https://api.github.com/users/npauzenga/repos","events_url":"https://api.github.com/users/npauzenga/events{/privacy}","received_events_url":"https://api.github.com/users/npauzenga/received_events","type":"User","site_admin":false},"repo":{"id":43097275,"name":"Bloccit","full_name":"npauzenga/Bloccit","owner":{"login":"npauzenga","id":5838826,"avatar_url":"https://avatars.githubusercontent.com/u/5838826?v=3","gravatar_id":"","url":"https://api.github.com/users/npauzenga","html_url":"https://github.com/npauzenga","followers_url":"https://api.github.com/users/npauzenga/followers","following_url":"https://api.github.com/users/npauzenga/following{/other_user}","gists_url":"https://api.github.com/users/npauzenga/gists{/gist_id}","starred_url":"https://api.github.com/users/npauzenga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/npauzenga/subscriptions","organizations_url":"https://api.github.com/users/npauzenga/orgs","repos_url":"https://api.github.com/users/npauzenga/repos","events_url":"https://api.github.com/users/npauzenga/events{/privacy}","received_events_url":"https://api.github.com/users/npauzenga/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/npauzenga/Bloccit","description":"A Reddit replica for educational purposes","fork":false,"url":"https://api.github.com/repos/npauzenga/Bloccit","forks_url":"https://api.github.com/repos/npauzenga/Bloccit/forks","keys_url":"https://api.github.com/repos/npauzenga/Bloccit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/npauzenga/Bloccit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/npauzenga/Bloccit/teams","hooks_url":"https://api.github.com/repos/npauzenga/Bloccit/hooks","issue_events_url":"https://api.github.com/repos/npauzenga/Bloccit/issues/events{/number}","events_url":"https://api.github.com/repos/npauzenga/Bloccit/events","assignees_url":"https://api.github.com/repos/npauzenga/Bloccit/assignees{/user}","branches_url":"https://api.github.com/repos/npauzenga/Bloccit/branches{/branch}","tags_url":"https://api.github.com/repos/npauzenga/Bloccit/tags","blobs_url":"https://api.github.com/repos/npauzenga/Bloccit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/npauzenga/Bloccit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/npauzenga/Bloccit/git/refs{/sha}","trees_url":"https://api.github.com/repos/npauzenga/Bloccit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/npauzenga/Bloccit/statuses/{sha}","languages_url":"https://api.github.com/repos/npauzenga/Bloccit/languages","stargazers_url":"https://api.github.com/repos/npauzenga/Bloccit/stargazers","contributors_url":"https://api.github.com/repos/npauzenga/Bloccit/contributors","subscribers_url":"https://api.github.com/repos/npauzenga/Bloccit/subscribers","subscription_url":"https://api.github.com/repos/npauzenga/Bloccit/subscription","commits_url":"https://api.github.com/repos/npauzenga/Bloccit/commits{/sha}","git_commits_url":"https://api.github.com/repos/npauzenga/Bloccit/git/commits{/sha}","comments_url":"https://api.github.com/repos/npauzenga/Bloccit/comments{/number}","issue_comment_url":"https://api.github.com/repos/npauzenga/Bloccit/issues/comments{/number}","contents_url":"https://api.github.com/repos/npauzenga/Bloccit/contents/{+path}","compare_url":"https://api.github.com/repos/npauzenga/Bloccit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/npauzenga/Bloccit/merges","archive_url":"https://api.github.com/repos/npauzenga/Bloccit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/npauzenga/Bloccit/downloads","issues_url":"https://api.github.com/repos/npauzenga/Bloccit/issues{/number}","pulls_url":"https://api.github.com/repos/npauzenga/Bloccit/pulls{/number}","milestones_url":"https://api.github.com/repos/npauzenga/Bloccit/milestones{/number}","notifications_url":"https://api.github.com/repos/npauzenga/Bloccit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/npauzenga/Bloccit/labels{/name}","releases_url":"https://api.github.com/repos/npauzenga/Bloccit/releases{/id}","created_at":"2015-09-24T22:52:13Z","updated_at":"2015-09-24T22:53:39Z","pushed_at":"2015-10-27T01:33:33Z","git_url":"git://github.com/npauzenga/Bloccit.git","ssh_url":"git@github.com:npauzenga/Bloccit.git","clone_url":"https://github.com/npauzenga/Bloccit.git","svn_url":"https://github.com/npauzenga/Bloccit","homepage":null,"size":1028,"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":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/npauzenga/Bloccit/pulls/26"},"html":{"href":"https://github.com/npauzenga/Bloccit/pull/26"},"issue":{"href":"https://api.github.com/repos/npauzenga/Bloccit/issues/26"},"comments":{"href":"https://api.github.com/repos/npauzenga/Bloccit/issues/26/comments"},"review_comments":{"href":"https://api.github.com/repos/npauzenga/Bloccit/pulls/26/comments"},"review_comment":{"href":"https://api.github.com/repos/npauzenga/Bloccit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/npauzenga/Bloccit/pulls/26/commits"},"statuses":{"href":"https://api.github.com/repos/npauzenga/Bloccit/statuses/b9cdfe7d420574ae6cd27a5470d7b5fab02ea337"}}}}