{"action":"created","comment":{"url":"https://api.github.com/repos/JoshuaFields/code-review-site/pulls/comments/28064389","id":28064389,"diff_hunk":"@@ -9,4 +9,20 @@ class Tutorial < ActiveRecord::Base\n \n   belongs_to :user\n   has_many :reviews, dependent: :destroy\n+  has_many :tutorials_tags\n+  has_many :tags, through: :tutorials_tags, dependent: :destroy\n+\n+  def all_tags=(names)\n+    self.tags = names.downcase.split(\",\").map do |name|\n+      Tag.where(tag_name: name.strip).first_or_create!\n+    end\n+  end\n+\n+  def all_tags\n+    self.tags.map(&:tag_name).join(\", \")","path":"app/models/tutorial.rb","position":14,"original_position":14,"commit_id":"b6056fac0ce88d1e95b30d6d2aaa219f07393964","original_commit_id":"2bcfae0efadeedf156095b355f5935c7f76819fc","user":{"login":"cmkoller","id":8670086,"avatar_url":"https://avatars.githubusercontent.com/u/8670086?v=3","gravatar_id":"","url":"https://api.github.com/users/cmkoller","html_url":"https://github.com/cmkoller","followers_url":"https://api.github.com/users/cmkoller/followers","following_url":"https://api.github.com/users/cmkoller/following{/other_user}","gists_url":"https://api.github.com/users/cmkoller/gists{/gist_id}","starred_url":"https://api.github.com/users/cmkoller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmkoller/subscriptions","organizations_url":"https://api.github.com/users/cmkoller/orgs","repos_url":"https://api.github.com/users/cmkoller/repos","events_url":"https://api.github.com/users/cmkoller/events{/privacy}","received_events_url":"https://api.github.com/users/cmkoller/received_events","type":"User","site_admin":false},"body":"listen to Hound here! You shouldn't need the `self` here or on line 16","created_at":"2015-04-09T14:12:29Z","updated_at":"2015-04-09T14:12:29Z","html_url":"https://github.com/JoshuaFields/code-review-site/pull/27#discussion_r28064389","pull_request_url":"https://api.github.com/repos/JoshuaFields/code-review-site/pulls/27","_links":{"self":{"href":"https://api.github.com/repos/JoshuaFields/code-review-site/pulls/comments/28064389"},"html":{"href":"https://github.com/JoshuaFields/code-review-site/pull/27#discussion_r28064389"},"pull_request":{"href":"https://api.github.com/repos/JoshuaFields/code-review-site/pulls/27"}}},"pull_request":{"url":"https://api.github.com/repos/JoshuaFields/code-review-site/pulls/27","id":32899250,"html_url":"https://github.com/JoshuaFields/code-review-site/pull/27","diff_url":"https://github.com/JoshuaFields/code-review-site/pull/27.diff","patch_url":"https://github.com/JoshuaFields/code-review-site/pull/27.patch","issue_url":"https://api.github.com/repos/JoshuaFields/code-review-site/issues/27","number":27,"state":"open","locked":false,"title":"Tags","user":{"login":"JoshuaFields","id":10090348,"avatar_url":"https://avatars.githubusercontent.com/u/10090348?v=3","gravatar_id":"","url":"https://api.github.com/users/JoshuaFields","html_url":"https://github.com/JoshuaFields","followers_url":"https://api.github.com/users/JoshuaFields/followers","following_url":"https://api.github.com/users/JoshuaFields/following{/other_user}","gists_url":"https://api.github.com/users/JoshuaFields/gists{/gist_id}","starred_url":"https://api.github.com/users/JoshuaFields/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoshuaFields/subscriptions","organizations_url":"https://api.github.com/users/JoshuaFields/orgs","repos_url":"https://api.github.com/users/JoshuaFields/repos","events_url":"https://api.github.com/users/JoshuaFields/events{/privacy}","received_events_url":"https://api.github.com/users/JoshuaFields/received_events","type":"User","site_admin":false},"body":"- add a tags feature (new table AND a join table!)\r\n- sort by tags on the index page\r\n- sort by newest and oldest tutorials on the index page\r\n- add related tests","created_at":"2015-04-08T20:35:26Z","updated_at":"2015-04-09T14:12:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/JoshuaFields/code-review-site/pulls/27/commits","review_comments_url":"https://api.github.com/repos/JoshuaFields/code-review-site/pulls/27/comments","review_comment_url":"https://api.github.com/repos/JoshuaFields/code-review-site/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JoshuaFields/code-review-site/issues/27/comments","statuses_url":"https://api.github.com/repos/JoshuaFields/code-review-site/statuses/b6056fac0ce88d1e95b30d6d2aaa219f07393964","head":{"label":"JoshuaFields:tags","ref":"tags","sha":"b6056fac0ce88d1e95b30d6d2aaa219f07393964","user":{"login":"JoshuaFields","id":10090348,"avatar_url":"https://avatars.githubusercontent.com/u/10090348?v=3","gravatar_id":"","url":"https://api.github.com/users/JoshuaFields","html_url":"https://github.com/JoshuaFields","followers_url":"https://api.github.com/users/JoshuaFields/followers","following_url":"https://api.github.com/users/JoshuaFields/following{/other_user}","gists_url":"https://api.github.com/users/JoshuaFields/gists{/gist_id}","starred_url":"https://api.github.com/users/JoshuaFields/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoshuaFields/subscriptions","organizations_url":"https://api.github.com/users/JoshuaFields/orgs","repos_url":"https://api.github.com/users/JoshuaFields/repos","events_url":"https://api.github.com/users/JoshuaFields/events{/privacy}","received_events_url":"https://api.github.com/users/JoshuaFields/received_events","type":"User","site_admin":false},"repo":{"id":33130933,"name":"code-review-site","full_name":"JoshuaFields/code-review-site","owner":{"login":"JoshuaFields","id":10090348,"avatar_url":"https://avatars.githubusercontent.com/u/10090348?v=3","gravatar_id":"","url":"https://api.github.com/users/JoshuaFields","html_url":"https://github.com/JoshuaFields","followers_url":"https://api.github.com/users/JoshuaFields/followers","following_url":"https://api.github.com/users/JoshuaFields/following{/other_user}","gists_url":"https://api.github.com/users/JoshuaFields/gists{/gist_id}","starred_url":"https://api.github.com/users/JoshuaFields/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoshuaFields/subscriptions","organizations_url":"https://api.github.com/users/JoshuaFields/orgs","repos_url":"https://api.github.com/users/JoshuaFields/repos","events_url":"https://api.github.com/users/JoshuaFields/events{/privacy}","received_events_url":"https://api.github.com/users/JoshuaFields/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JoshuaFields/code-review-site","description":"A website for reviewing coding tutorials","fork":false,"url":"https://api.github.com/repos/JoshuaFields/code-review-site","forks_url":"https://api.github.com/repos/JoshuaFields/code-review-site/forks","keys_url":"https://api.github.com/repos/JoshuaFields/code-review-site/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JoshuaFields/code-review-site/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JoshuaFields/code-review-site/teams","hooks_url":"https://api.github.com/repos/JoshuaFields/code-review-site/hooks","issue_events_url":"https://api.github.com/repos/JoshuaFields/code-review-site/issues/events{/number}","events_url":"https://api.github.com/repos/JoshuaFields/code-review-site/events","assignees_url":"https://api.github.com/repos/JoshuaFields/code-review-site/assignees{/user}","branches_url":"https://api.github.com/repos/JoshuaFields/code-review-site/branches{/branch}","tags_url":"https://api.github.com/repos/JoshuaFields/code-review-site/tags","blobs_url":"https://api.github.com/repos/JoshuaFields/code-review-site/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JoshuaFields/code-review-site/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JoshuaFields/code-review-site/git/refs{/sha}","trees_url":"https://api.github.com/repos/JoshuaFields/code-review-site/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JoshuaFields/code-review-site/statuses/{sha}","languages_url":"https://api.github.com/repos/JoshuaFields/code-review-site/languages","stargazers_url":"https://api.github.com/repos/JoshuaFields/code-review-site/stargazers","contributors_url":"https://api.github.com/repos/JoshuaFields/code-review-site/contributors","subscribers_url":"https://api.github.com/repos/JoshuaFields/code-review-site/subscribers","subscription_url":"https://api.github.com/repos/JoshuaFields/code-review-site/subscription","commits_url":"https://api.github.com/repos/JoshuaFields/code-review-site/commits{/sha}","git_commits_url":"https://api.github.com/repos/JoshuaFields/code-review-site/git/commits{/sha}","comments_url":"https://api.github.com/repos/JoshuaFields/code-review-site/comments{/number}","issue_comment_url":"https://api.github.com/repos/JoshuaFields/code-review-site/issues/comments{/number}","contents_url":"https://api.github.com/repos/JoshuaFields/code-review-site/contents/{+path}","compare_url":"https://api.github.com/repos/JoshuaFields/code-review-site/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JoshuaFields/code-review-site/merges","archive_url":"https://api.github.com/repos/JoshuaFields/code-review-site/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JoshuaFields/code-review-site/downloads","issues_url":"https://api.github.com/repos/JoshuaFields/code-review-site/issues{/number}","pulls_url":"https://api.github.com/repos/JoshuaFields/code-review-site/pulls{/number}","milestones_url":"https://api.github.com/repos/JoshuaFields/code-review-site/milestones{/number}","notifications_url":"https://api.github.com/repos/JoshuaFields/code-review-site/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JoshuaFields/code-review-site/labels{/name}","releases_url":"https://api.github.com/repos/JoshuaFields/code-review-site/releases{/id}","created_at":"2015-03-30T15:19:13Z","updated_at":"2015-04-09T14:08:17Z","pushed_at":"2015-04-09T14:08:17Z","git_url":"git://github.com/JoshuaFields/code-review-site.git","ssh_url":"git@github.com:JoshuaFields/code-review-site.git","clone_url":"https://github.com/JoshuaFields/code-review-site.git","svn_url":"https://github.com/JoshuaFields/code-review-site","homepage":null,"size":1336,"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":"JoshuaFields:master","ref":"master","sha":"6e290ec17776ce955de5c72a4ca55c434e05fe72","user":{"login":"JoshuaFields","id":10090348,"avatar_url":"https://avatars.githubusercontent.com/u/10090348?v=3","gravatar_id":"","url":"https://api.github.com/users/JoshuaFields","html_url":"https://github.com/JoshuaFields","followers_url":"https://api.github.com/users/JoshuaFields/followers","following_url":"https://api.github.com/users/JoshuaFields/following{/other_user}","gists_url":"https://api.github.com/users/JoshuaFields/gists{/gist_id}","starred_url":"https://api.github.com/users/JoshuaFields/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoshuaFields/subscriptions","organizations_url":"https://api.github.com/users/JoshuaFields/orgs","repos_url":"https://api.github.com/users/JoshuaFields/repos","events_url":"https://api.github.com/users/JoshuaFields/events{/privacy}","received_events_url":"https://api.github.com/users/JoshuaFields/received_events","type":"User","site_admin":false},"repo":{"id":33130933,"name":"code-review-site","full_name":"JoshuaFields/code-review-site","owner":{"login":"JoshuaFields","id":10090348,"avatar_url":"https://avatars.githubusercontent.com/u/10090348?v=3","gravatar_id":"","url":"https://api.github.com/users/JoshuaFields","html_url":"https://github.com/JoshuaFields","followers_url":"https://api.github.com/users/JoshuaFields/followers","following_url":"https://api.github.com/users/JoshuaFields/following{/other_user}","gists_url":"https://api.github.com/users/JoshuaFields/gists{/gist_id}","starred_url":"https://api.github.com/users/JoshuaFields/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoshuaFields/subscriptions","organizations_url":"https://api.github.com/users/JoshuaFields/orgs","repos_url":"https://api.github.com/users/JoshuaFields/repos","events_url":"https://api.github.com/users/JoshuaFields/events{/privacy}","received_events_url":"https://api.github.com/users/JoshuaFields/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JoshuaFields/code-review-site","description":"A website for reviewing coding tutorials","fork":false,"url":"https://api.github.com/repos/JoshuaFields/code-review-site","forks_url":"https://api.github.com/repos/JoshuaFields/code-review-site/forks","keys_url":"https://api.github.com/repos/JoshuaFields/code-review-site/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JoshuaFields/code-review-site/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JoshuaFields/code-review-site/teams","hooks_url":"https://api.github.com/repos/JoshuaFields/code-review-site/hooks","issue_events_url":"https://api.github.com/repos/JoshuaFields/code-review-site/issues/events{/number}","events_url":"https://api.github.com/repos/JoshuaFields/code-review-site/events","assignees_url":"https://api.github.com/repos/JoshuaFields/code-review-site/assignees{/user}","branches_url":"https://api.github.com/repos/JoshuaFields/code-review-site/branches{/branch}","tags_url":"https://api.github.com/repos/JoshuaFields/code-review-site/tags","blobs_url":"https://api.github.com/repos/JoshuaFields/code-review-site/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JoshuaFields/code-review-site/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JoshuaFields/code-review-site/git/refs{/sha}","trees_url":"https://api.github.com/repos/JoshuaFields/code-review-site/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JoshuaFields/code-review-site/statuses/{sha}","languages_url":"https://api.github.com/repos/JoshuaFields/code-review-site/languages","stargazers_url":"https://api.github.com/repos/JoshuaFields/code-review-site/stargazers","contributors_url":"https://api.github.com/repos/JoshuaFields/code-review-site/contributors","subscribers_url":"https://api.github.com/repos/JoshuaFields/code-review-site/subscribers","subscription_url":"https://api.github.com/repos/JoshuaFields/code-review-site/subscription","commits_url":"https://api.github.com/repos/JoshuaFields/code-review-site/commits{/sha}","git_commits_url":"https://api.github.com/repos/JoshuaFields/code-review-site/git/commits{/sha}","comments_url":"https://api.github.com/repos/JoshuaFields/code-review-site/comments{/number}","issue_comment_url":"https://api.github.com/repos/JoshuaFields/code-review-site/issues/comments{/number}","contents_url":"https://api.github.com/repos/JoshuaFields/code-review-site/contents/{+path}","compare_url":"https://api.github.com/repos/JoshuaFields/code-review-site/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JoshuaFields/code-review-site/merges","archive_url":"https://api.github.com/repos/JoshuaFields/code-review-site/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JoshuaFields/code-review-site/downloads","issues_url":"https://api.github.com/repos/JoshuaFields/code-review-site/issues{/number}","pulls_url":"https://api.github.com/repos/JoshuaFields/code-review-site/pulls{/number}","milestones_url":"https://api.github.com/repos/JoshuaFields/code-review-site/milestones{/number}","notifications_url":"https://api.github.com/repos/JoshuaFields/code-review-site/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JoshuaFields/code-review-site/labels{/name}","releases_url":"https://api.github.com/repos/JoshuaFields/code-review-site/releases{/id}","created_at":"2015-03-30T15:19:13Z","updated_at":"2015-04-09T14:08:17Z","pushed_at":"2015-04-09T14:08:17Z","git_url":"git://github.com/JoshuaFields/code-review-site.git","ssh_url":"git@github.com:JoshuaFields/code-review-site.git","clone_url":"https://github.com/JoshuaFields/code-review-site.git","svn_url":"https://github.com/JoshuaFields/code-review-site","homepage":null,"size":1336,"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/JoshuaFields/code-review-site/pulls/27"},"html":{"href":"https://github.com/JoshuaFields/code-review-site/pull/27"},"issue":{"href":"https://api.github.com/repos/JoshuaFields/code-review-site/issues/27"},"comments":{"href":"https://api.github.com/repos/JoshuaFields/code-review-site/issues/27/comments"},"review_comments":{"href":"https://api.github.com/repos/JoshuaFields/code-review-site/pulls/27/comments"},"review_comment":{"href":"https://api.github.com/repos/JoshuaFields/code-review-site/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JoshuaFields/code-review-site/pulls/27/commits"},"statuses":{"href":"https://api.github.com/repos/JoshuaFields/code-review-site/statuses/b6056fac0ce88d1e95b30d6d2aaa219f07393964"}}}}