{"action":"created","comment":{"url":"https://api.github.com/repos/vikingeducation/project_danebook/pulls/comments/75778151","id":75778151,"diff_hunk":"@@ -0,0 +1,61 @@\n+class LikesController < ApplicationController\n+\n+  def create\n+    #if its for a post\n+    if params[:post_id]\n+      @post = Post.find(params[:post_id])\n+      @user = @post.user\n+      @like = @post.likes.build(:user_id => current_user.id)\n+    #if its for a comment\n+    elsif params[:comment_id]\n+      @comment = Comment.find(params[:comment_id])\n+      @like = @comment.likes.build(:user_id => current_user.id)\n+      #if its for a photo\n+    else\n+      @photo = Photo.find(params[:photo_id])\n+      @user = @photo.user\n+      @like = @photo.likes.build(:user_id => current_user.id)\n+    end\n+    @like.save\n+    if params[:post_id]\n+      redirect_to user_posts_path(@user)\n+    elsif params[:comment_id] && @comment.commentable_type == \"Post\"\n+      @user = @comment.commentable.user\n+      redirect_to user_posts_path(@user)\n+    elsif params[:comment_id] && @comment.commentable_type == \"Photo\"\n+      @photo = @comment.commentable\n+      redirect_to photo_path(@photo)\n+    else\n+      redirect_to photo_path(@photo)\n+    end\n+  end\n+","path":"app/controllers/likes_controller.rb","position":32,"original_position":32,"commit_id":"d42ed8ad598351e0a04a8830cc199b1dd6e6c3f2","original_commit_id":"d42ed8ad598351e0a04a8830cc199b1dd6e6c3f2","user":{"login":"tgturner","id":16597153,"avatar_url":"https://avatars.githubusercontent.com/u/16597153?v=3","gravatar_id":"","url":"https://api.github.com/users/tgturner","html_url":"https://github.com/tgturner","followers_url":"https://api.github.com/users/tgturner/followers","following_url":"https://api.github.com/users/tgturner/following{/other_user}","gists_url":"https://api.github.com/users/tgturner/gists{/gist_id}","starred_url":"https://api.github.com/users/tgturner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgturner/subscriptions","organizations_url":"https://api.github.com/users/tgturner/orgs","repos_url":"https://api.github.com/users/tgturner/repos","events_url":"https://api.github.com/users/tgturner/events{/privacy}","received_events_url":"https://api.github.com/users/tgturner/received_events","type":"User","site_admin":false},"body":"Repeat regarding pulling some of this hairy logic out","created_at":"2016-08-22T23:25:47Z","updated_at":"2016-08-22T23:25:47Z","html_url":"https://github.com/vikingeducation/project_danebook/pull/36#discussion_r75778151","pull_request_url":"https://api.github.com/repos/vikingeducation/project_danebook/pulls/36","_links":{"self":{"href":"https://api.github.com/repos/vikingeducation/project_danebook/pulls/comments/75778151"},"html":{"href":"https://github.com/vikingeducation/project_danebook/pull/36#discussion_r75778151"},"pull_request":{"href":"https://api.github.com/repos/vikingeducation/project_danebook/pulls/36"}}},"pull_request":{"url":"https://api.github.com/repos/vikingeducation/project_danebook/pulls/36","id":81194720,"html_url":"https://github.com/vikingeducation/project_danebook/pull/36","diff_url":"https://github.com/vikingeducation/project_danebook/pull/36.diff","patch_url":"https://github.com/vikingeducation/project_danebook/pull/36.patch","issue_url":"https://api.github.com/repos/vikingeducation/project_danebook/issues/36","number":36,"state":"open","locked":false,"title":"Danebook","user":{"login":"davidmjiang","id":16966368,"avatar_url":"https://avatars.githubusercontent.com/u/16966368?v=3","gravatar_id":"","url":"https://api.github.com/users/davidmjiang","html_url":"https://github.com/davidmjiang","followers_url":"https://api.github.com/users/davidmjiang/followers","following_url":"https://api.github.com/users/davidmjiang/following{/other_user}","gists_url":"https://api.github.com/users/davidmjiang/gists{/gist_id}","starred_url":"https://api.github.com/users/davidmjiang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidmjiang/subscriptions","organizations_url":"https://api.github.com/users/davidmjiang/orgs","repos_url":"https://api.github.com/users/davidmjiang/repos","events_url":"https://api.github.com/users/davidmjiang/events{/privacy}","received_events_url":"https://api.github.com/users/davidmjiang/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-08-12T23:02:00Z","updated_at":"2016-08-22T23:25:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ee9b95dc60ae442c19ee74443a45e5d3a60c599e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/vikingeducation/project_danebook/pulls/36/commits","review_comments_url":"https://api.github.com/repos/vikingeducation/project_danebook/pulls/36/comments","review_comment_url":"https://api.github.com/repos/vikingeducation/project_danebook/pulls/comments{/number}","comments_url":"https://api.github.com/repos/vikingeducation/project_danebook/issues/36/comments","statuses_url":"https://api.github.com/repos/vikingeducation/project_danebook/statuses/d42ed8ad598351e0a04a8830cc199b1dd6e6c3f2","head":{"label":"davidmjiang:master","ref":"master","sha":"d42ed8ad598351e0a04a8830cc199b1dd6e6c3f2","user":{"login":"davidmjiang","id":16966368,"avatar_url":"https://avatars.githubusercontent.com/u/16966368?v=3","gravatar_id":"","url":"https://api.github.com/users/davidmjiang","html_url":"https://github.com/davidmjiang","followers_url":"https://api.github.com/users/davidmjiang/followers","following_url":"https://api.github.com/users/davidmjiang/following{/other_user}","gists_url":"https://api.github.com/users/davidmjiang/gists{/gist_id}","starred_url":"https://api.github.com/users/davidmjiang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidmjiang/subscriptions","organizations_url":"https://api.github.com/users/davidmjiang/orgs","repos_url":"https://api.github.com/users/davidmjiang/repos","events_url":"https://api.github.com/users/davidmjiang/events{/privacy}","received_events_url":"https://api.github.com/users/davidmjiang/received_events","type":"User","site_admin":false},"repo":{"id":65406019,"name":"project_danebook","full_name":"davidmjiang/project_danebook","owner":{"login":"davidmjiang","id":16966368,"avatar_url":"https://avatars.githubusercontent.com/u/16966368?v=3","gravatar_id":"","url":"https://api.github.com/users/davidmjiang","html_url":"https://github.com/davidmjiang","followers_url":"https://api.github.com/users/davidmjiang/followers","following_url":"https://api.github.com/users/davidmjiang/following{/other_user}","gists_url":"https://api.github.com/users/davidmjiang/gists{/gist_id}","starred_url":"https://api.github.com/users/davidmjiang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidmjiang/subscriptions","organizations_url":"https://api.github.com/users/davidmjiang/orgs","repos_url":"https://api.github.com/users/davidmjiang/repos","events_url":"https://api.github.com/users/davidmjiang/events{/privacy}","received_events_url":"https://api.github.com/users/davidmjiang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/davidmjiang/project_danebook","description":"This is the Real Dane Deal.","fork":true,"url":"https://api.github.com/repos/davidmjiang/project_danebook","forks_url":"https://api.github.com/repos/davidmjiang/project_danebook/forks","keys_url":"https://api.github.com/repos/davidmjiang/project_danebook/keys{/key_id}","collaborators_url":"https://api.github.com/repos/davidmjiang/project_danebook/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/davidmjiang/project_danebook/teams","hooks_url":"https://api.github.com/repos/davidmjiang/project_danebook/hooks","issue_events_url":"https://api.github.com/repos/davidmjiang/project_danebook/issues/events{/number}","events_url":"https://api.github.com/repos/davidmjiang/project_danebook/events","assignees_url":"https://api.github.com/repos/davidmjiang/project_danebook/assignees{/user}","branches_url":"https://api.github.com/repos/davidmjiang/project_danebook/branches{/branch}","tags_url":"https://api.github.com/repos/davidmjiang/project_danebook/tags","blobs_url":"https://api.github.com/repos/davidmjiang/project_danebook/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/davidmjiang/project_danebook/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/davidmjiang/project_danebook/git/refs{/sha}","trees_url":"https://api.github.com/repos/davidmjiang/project_danebook/git/trees{/sha}","statuses_url":"https://api.github.com/repos/davidmjiang/project_danebook/statuses/{sha}","languages_url":"https://api.github.com/repos/davidmjiang/project_danebook/languages","stargazers_url":"https://api.github.com/repos/davidmjiang/project_danebook/stargazers","contributors_url":"https://api.github.com/repos/davidmjiang/project_danebook/contributors","subscribers_url":"https://api.github.com/repos/davidmjiang/project_danebook/subscribers","subscription_url":"https://api.github.com/repos/davidmjiang/project_danebook/subscription","commits_url":"https://api.github.com/repos/davidmjiang/project_danebook/commits{/sha}","git_commits_url":"https://api.github.com/repos/davidmjiang/project_danebook/git/commits{/sha}","comments_url":"https://api.github.com/repos/davidmjiang/project_danebook/comments{/number}","issue_comment_url":"https://api.github.com/repos/davidmjiang/project_danebook/issues/comments{/number}","contents_url":"https://api.github.com/repos/davidmjiang/project_danebook/contents/{+path}","compare_url":"https://api.github.com/repos/davidmjiang/project_danebook/compare/{base}...{head}","merges_url":"https://api.github.com/repos/davidmjiang/project_danebook/merges","archive_url":"https://api.github.com/repos/davidmjiang/project_danebook/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/davidmjiang/project_danebook/downloads","issues_url":"https://api.github.com/repos/davidmjiang/project_danebook/issues{/number}","pulls_url":"https://api.github.com/repos/davidmjiang/project_danebook/pulls{/number}","milestones_url":"https://api.github.com/repos/davidmjiang/project_danebook/milestones{/number}","notifications_url":"https://api.github.com/repos/davidmjiang/project_danebook/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/davidmjiang/project_danebook/labels{/name}","releases_url":"https://api.github.com/repos/davidmjiang/project_danebook/releases{/id}","deployments_url":"https://api.github.com/repos/davidmjiang/project_danebook/deployments","created_at":"2016-08-10T18:17:48Z","updated_at":"2016-08-16T01:24:12Z","pushed_at":"2016-08-22T23:13:18Z","git_url":"git://github.com/davidmjiang/project_danebook.git","ssh_url":"git@github.com:davidmjiang/project_danebook.git","clone_url":"https://github.com/davidmjiang/project_danebook.git","svn_url":"https://github.com/davidmjiang/project_danebook","homepage":null,"size":217,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"vikingeducation:master","ref":"master","sha":"5d92a86445ce8cb1e62f1a14b9d019bbeaa2e2f0","user":{"login":"vikingeducation","id":7231832,"avatar_url":"https://avatars.githubusercontent.com/u/7231832?v=3","gravatar_id":"","url":"https://api.github.com/users/vikingeducation","html_url":"https://github.com/vikingeducation","followers_url":"https://api.github.com/users/vikingeducation/followers","following_url":"https://api.github.com/users/vikingeducation/following{/other_user}","gists_url":"https://api.github.com/users/vikingeducation/gists{/gist_id}","starred_url":"https://api.github.com/users/vikingeducation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vikingeducation/subscriptions","organizations_url":"https://api.github.com/users/vikingeducation/orgs","repos_url":"https://api.github.com/users/vikingeducation/repos","events_url":"https://api.github.com/users/vikingeducation/events{/privacy}","received_events_url":"https://api.github.com/users/vikingeducation/received_events","type":"Organization","site_admin":false},"repo":{"id":25442463,"name":"project_danebook","full_name":"vikingeducation/project_danebook","owner":{"login":"vikingeducation","id":7231832,"avatar_url":"https://avatars.githubusercontent.com/u/7231832?v=3","gravatar_id":"","url":"https://api.github.com/users/vikingeducation","html_url":"https://github.com/vikingeducation","followers_url":"https://api.github.com/users/vikingeducation/followers","following_url":"https://api.github.com/users/vikingeducation/following{/other_user}","gists_url":"https://api.github.com/users/vikingeducation/gists{/gist_id}","starred_url":"https://api.github.com/users/vikingeducation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vikingeducation/subscriptions","organizations_url":"https://api.github.com/users/vikingeducation/orgs","repos_url":"https://api.github.com/users/vikingeducation/repos","events_url":"https://api.github.com/users/vikingeducation/events{/privacy}","received_events_url":"https://api.github.com/users/vikingeducation/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/vikingeducation/project_danebook","description":"This is the Real Dane Deal.","fork":false,"url":"https://api.github.com/repos/vikingeducation/project_danebook","forks_url":"https://api.github.com/repos/vikingeducation/project_danebook/forks","keys_url":"https://api.github.com/repos/vikingeducation/project_danebook/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vikingeducation/project_danebook/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vikingeducation/project_danebook/teams","hooks_url":"https://api.github.com/repos/vikingeducation/project_danebook/hooks","issue_events_url":"https://api.github.com/repos/vikingeducation/project_danebook/issues/events{/number}","events_url":"https://api.github.com/repos/vikingeducation/project_danebook/events","assignees_url":"https://api.github.com/repos/vikingeducation/project_danebook/assignees{/user}","branches_url":"https://api.github.com/repos/vikingeducation/project_danebook/branches{/branch}","tags_url":"https://api.github.com/repos/vikingeducation/project_danebook/tags","blobs_url":"https://api.github.com/repos/vikingeducation/project_danebook/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vikingeducation/project_danebook/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vikingeducation/project_danebook/git/refs{/sha}","trees_url":"https://api.github.com/repos/vikingeducation/project_danebook/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vikingeducation/project_danebook/statuses/{sha}","languages_url":"https://api.github.com/repos/vikingeducation/project_danebook/languages","stargazers_url":"https://api.github.com/repos/vikingeducation/project_danebook/stargazers","contributors_url":"https://api.github.com/repos/vikingeducation/project_danebook/contributors","subscribers_url":"https://api.github.com/repos/vikingeducation/project_danebook/subscribers","subscription_url":"https://api.github.com/repos/vikingeducation/project_danebook/subscription","commits_url":"https://api.github.com/repos/vikingeducation/project_danebook/commits{/sha}","git_commits_url":"https://api.github.com/repos/vikingeducation/project_danebook/git/commits{/sha}","comments_url":"https://api.github.com/repos/vikingeducation/project_danebook/comments{/number}","issue_comment_url":"https://api.github.com/repos/vikingeducation/project_danebook/issues/comments{/number}","contents_url":"https://api.github.com/repos/vikingeducation/project_danebook/contents/{+path}","compare_url":"https://api.github.com/repos/vikingeducation/project_danebook/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vikingeducation/project_danebook/merges","archive_url":"https://api.github.com/repos/vikingeducation/project_danebook/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vikingeducation/project_danebook/downloads","issues_url":"https://api.github.com/repos/vikingeducation/project_danebook/issues{/number}","pulls_url":"https://api.github.com/repos/vikingeducation/project_danebook/pulls{/number}","milestones_url":"https://api.github.com/repos/vikingeducation/project_danebook/milestones{/number}","notifications_url":"https://api.github.com/repos/vikingeducation/project_danebook/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vikingeducation/project_danebook/labels{/name}","releases_url":"https://api.github.com/repos/vikingeducation/project_danebook/releases{/id}","deployments_url":"https://api.github.com/repos/vikingeducation/project_danebook/deployments","created_at":"2014-10-19T22:43:28Z","updated_at":"2016-06-21T15:57:55Z","pushed_at":"2016-08-22T23:16:37Z","git_url":"git://github.com/vikingeducation/project_danebook.git","ssh_url":"git@github.com:vikingeducation/project_danebook.git","clone_url":"https://github.com/vikingeducation/project_danebook.git","svn_url":"https://github.com/vikingeducation/project_danebook","homepage":null,"size":29224,"stargazers_count":1,"watchers_count":1,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":49,"mirror_url":null,"open_issues_count":43,"forks":49,"open_issues":43,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/vikingeducation/project_danebook/pulls/36"},"html":{"href":"https://github.com/vikingeducation/project_danebook/pull/36"},"issue":{"href":"https://api.github.com/repos/vikingeducation/project_danebook/issues/36"},"comments":{"href":"https://api.github.com/repos/vikingeducation/project_danebook/issues/36/comments"},"review_comments":{"href":"https://api.github.com/repos/vikingeducation/project_danebook/pulls/36/comments"},"review_comment":{"href":"https://api.github.com/repos/vikingeducation/project_danebook/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/vikingeducation/project_danebook/pulls/36/commits"},"statuses":{"href":"https://api.github.com/repos/vikingeducation/project_danebook/statuses/d42ed8ad598351e0a04a8830cc199b1dd6e6c3f2"}}}}
{"actor":{"display_login":"tgturner"}}