{"action":"created","comment":{"url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/pulls/comments/88631922","pull_request_review_id":9199933,"id":88631922,"diff_hunk":"@@ -4,6 +4,17 @@ class User < ApplicationRecord\n \n   has_many :articles, foreign_key: 'author_id', dependent: :destroy\n   has_many :comments, dependent: :destroy\n+  has_many :likes, dependent: :destroy\n+  has_many :liked_articles, through: :likes, source: :article\n \n   validates :username, presence: true, length: { minimum: 2, maximum: 90 }\n+\n+  def like(article)\n+    like = likes.build(article: article)\n+    likes << like\n+  end\n+\n+  def unlike(article)\n+    likes.find_by(article: article).try(:destroy)","path":"app/models/user.rb","position":15,"original_position":15,"commit_id":"43cb837f2f893dbdad7cff22db6b38e5a1cffab9","original_commit_id":"43cb837f2f893dbdad7cff22db6b38e5a1cffab9","user":{"login":"vladimirbazhanov","id":275709,"avatar_url":"https://avatars.githubusercontent.com/u/275709?v=3","gravatar_id":"","url":"https://api.github.com/users/vladimirbazhanov","html_url":"https://github.com/vladimirbazhanov","followers_url":"https://api.github.com/users/vladimirbazhanov/followers","following_url":"https://api.github.com/users/vladimirbazhanov/following{/other_user}","gists_url":"https://api.github.com/users/vladimirbazhanov/gists{/gist_id}","starred_url":"https://api.github.com/users/vladimirbazhanov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vladimirbazhanov/subscriptions","organizations_url":"https://api.github.com/users/vladimirbazhanov/orgs","repos_url":"https://api.github.com/users/vladimirbazhanov/repos","events_url":"https://api.github.com/users/vladimirbazhanov/events{/privacy}","received_events_url":"https://api.github.com/users/vladimirbazhanov/received_events","type":"User","site_admin":false},"body":"and this.\r\n\r\nAlso, we have an idea that if you need to use 'try' somewhere - it means that you need to re-create that code and dont use 'try' :)","created_at":"2016-11-18T10:22:19Z","updated_at":"2016-11-18T10:22:19Z","html_url":"https://github.com/RuslanKhabibullin/intern_project/pull/3#discussion_r88631922","pull_request_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/RuslanKhabibullin/intern_project/pulls/comments/88631922"},"html":{"href":"https://github.com/RuslanKhabibullin/intern_project/pull/3#discussion_r88631922"},"pull_request":{"href":"https://api.github.com/repos/RuslanKhabibullin/intern_project/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/pulls/3","id":93622910,"html_url":"https://github.com/RuslanKhabibullin/intern_project/pull/3","diff_url":"https://github.com/RuslanKhabibullin/intern_project/pull/3.diff","patch_url":"https://github.com/RuslanKhabibullin/intern_project/pull/3.patch","issue_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/issues/3","number":3,"state":"open","locked":false,"title":"User likes","user":{"login":"RuslanKhabibullin","id":23027045,"avatar_url":"https://avatars.githubusercontent.com/u/23027045?v=3","gravatar_id":"","url":"https://api.github.com/users/RuslanKhabibullin","html_url":"https://github.com/RuslanKhabibullin","followers_url":"https://api.github.com/users/RuslanKhabibullin/followers","following_url":"https://api.github.com/users/RuslanKhabibullin/following{/other_user}","gists_url":"https://api.github.com/users/RuslanKhabibullin/gists{/gist_id}","starred_url":"https://api.github.com/users/RuslanKhabibullin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RuslanKhabibullin/subscriptions","organizations_url":"https://api.github.com/users/RuslanKhabibullin/orgs","repos_url":"https://api.github.com/users/RuslanKhabibullin/repos","events_url":"https://api.github.com/users/RuslanKhabibullin/events{/privacy}","received_events_url":"https://api.github.com/users/RuslanKhabibullin/received_events","type":"User","site_admin":false},"body":"User article likes + sorting by newest articles, or popularity(article likes count)","created_at":"2016-11-14T18:42:22Z","updated_at":"2016-11-18T10:22:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"81d4dad8d334e1dd4e6f7f19d31f1b87c733ae6b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/pulls/3/commits","review_comments_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/pulls/3/comments","review_comment_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/pulls/comments{/number}","comments_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/issues/3/comments","statuses_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/statuses/43cb837f2f893dbdad7cff22db6b38e5a1cffab9","head":{"label":"RuslanKhabibullin:user_likes","ref":"user_likes","sha":"43cb837f2f893dbdad7cff22db6b38e5a1cffab9","user":{"login":"RuslanKhabibullin","id":23027045,"avatar_url":"https://avatars.githubusercontent.com/u/23027045?v=3","gravatar_id":"","url":"https://api.github.com/users/RuslanKhabibullin","html_url":"https://github.com/RuslanKhabibullin","followers_url":"https://api.github.com/users/RuslanKhabibullin/followers","following_url":"https://api.github.com/users/RuslanKhabibullin/following{/other_user}","gists_url":"https://api.github.com/users/RuslanKhabibullin/gists{/gist_id}","starred_url":"https://api.github.com/users/RuslanKhabibullin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RuslanKhabibullin/subscriptions","organizations_url":"https://api.github.com/users/RuslanKhabibullin/orgs","repos_url":"https://api.github.com/users/RuslanKhabibullin/repos","events_url":"https://api.github.com/users/RuslanKhabibullin/events{/privacy}","received_events_url":"https://api.github.com/users/RuslanKhabibullin/received_events","type":"User","site_admin":false},"repo":{"id":71988072,"name":"intern_project","full_name":"RuslanKhabibullin/intern_project","owner":{"login":"RuslanKhabibullin","id":23027045,"avatar_url":"https://avatars.githubusercontent.com/u/23027045?v=3","gravatar_id":"","url":"https://api.github.com/users/RuslanKhabibullin","html_url":"https://github.com/RuslanKhabibullin","followers_url":"https://api.github.com/users/RuslanKhabibullin/followers","following_url":"https://api.github.com/users/RuslanKhabibullin/following{/other_user}","gists_url":"https://api.github.com/users/RuslanKhabibullin/gists{/gist_id}","starred_url":"https://api.github.com/users/RuslanKhabibullin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RuslanKhabibullin/subscriptions","organizations_url":"https://api.github.com/users/RuslanKhabibullin/orgs","repos_url":"https://api.github.com/users/RuslanKhabibullin/repos","events_url":"https://api.github.com/users/RuslanKhabibullin/events{/privacy}","received_events_url":"https://api.github.com/users/RuslanKhabibullin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/RuslanKhabibullin/intern_project","description":null,"fork":false,"url":"https://api.github.com/repos/RuslanKhabibullin/intern_project","forks_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/forks","keys_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/teams","hooks_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/hooks","issue_events_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/issues/events{/number}","events_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/events","assignees_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/assignees{/user}","branches_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/branches{/branch}","tags_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/tags","blobs_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/git/refs{/sha}","trees_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/statuses/{sha}","languages_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/languages","stargazers_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/stargazers","contributors_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/contributors","subscribers_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/subscribers","subscription_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/subscription","commits_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/commits{/sha}","git_commits_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/git/commits{/sha}","comments_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/comments{/number}","issue_comment_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/issues/comments{/number}","contents_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/contents/{+path}","compare_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/merges","archive_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/downloads","issues_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/issues{/number}","pulls_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/pulls{/number}","milestones_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/milestones{/number}","notifications_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/labels{/name}","releases_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/releases{/id}","deployments_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/deployments","created_at":"2016-10-26T09:32:54Z","updated_at":"2016-10-26T09:34:38Z","pushed_at":"2016-11-14T18:42:22Z","git_url":"git://github.com/RuslanKhabibullin/intern_project.git","ssh_url":"git@github.com:RuslanKhabibullin/intern_project.git","clone_url":"https://github.com/RuslanKhabibullin/intern_project.git","svn_url":"https://github.com/RuslanKhabibullin/intern_project","homepage":null,"size":133,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"RuslanKhabibullin:master","ref":"master","sha":"a5630a3b2de03886a3399fdd506377fde9b34190","user":{"login":"RuslanKhabibullin","id":23027045,"avatar_url":"https://avatars.githubusercontent.com/u/23027045?v=3","gravatar_id":"","url":"https://api.github.com/users/RuslanKhabibullin","html_url":"https://github.com/RuslanKhabibullin","followers_url":"https://api.github.com/users/RuslanKhabibullin/followers","following_url":"https://api.github.com/users/RuslanKhabibullin/following{/other_user}","gists_url":"https://api.github.com/users/RuslanKhabibullin/gists{/gist_id}","starred_url":"https://api.github.com/users/RuslanKhabibullin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RuslanKhabibullin/subscriptions","organizations_url":"https://api.github.com/users/RuslanKhabibullin/orgs","repos_url":"https://api.github.com/users/RuslanKhabibullin/repos","events_url":"https://api.github.com/users/RuslanKhabibullin/events{/privacy}","received_events_url":"https://api.github.com/users/RuslanKhabibullin/received_events","type":"User","site_admin":false},"repo":{"id":71988072,"name":"intern_project","full_name":"RuslanKhabibullin/intern_project","owner":{"login":"RuslanKhabibullin","id":23027045,"avatar_url":"https://avatars.githubusercontent.com/u/23027045?v=3","gravatar_id":"","url":"https://api.github.com/users/RuslanKhabibullin","html_url":"https://github.com/RuslanKhabibullin","followers_url":"https://api.github.com/users/RuslanKhabibullin/followers","following_url":"https://api.github.com/users/RuslanKhabibullin/following{/other_user}","gists_url":"https://api.github.com/users/RuslanKhabibullin/gists{/gist_id}","starred_url":"https://api.github.com/users/RuslanKhabibullin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RuslanKhabibullin/subscriptions","organizations_url":"https://api.github.com/users/RuslanKhabibullin/orgs","repos_url":"https://api.github.com/users/RuslanKhabibullin/repos","events_url":"https://api.github.com/users/RuslanKhabibullin/events{/privacy}","received_events_url":"https://api.github.com/users/RuslanKhabibullin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/RuslanKhabibullin/intern_project","description":null,"fork":false,"url":"https://api.github.com/repos/RuslanKhabibullin/intern_project","forks_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/forks","keys_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/teams","hooks_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/hooks","issue_events_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/issues/events{/number}","events_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/events","assignees_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/assignees{/user}","branches_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/branches{/branch}","tags_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/tags","blobs_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/git/refs{/sha}","trees_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/statuses/{sha}","languages_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/languages","stargazers_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/stargazers","contributors_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/contributors","subscribers_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/subscribers","subscription_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/subscription","commits_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/commits{/sha}","git_commits_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/git/commits{/sha}","comments_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/comments{/number}","issue_comment_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/issues/comments{/number}","contents_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/contents/{+path}","compare_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/merges","archive_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/downloads","issues_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/issues{/number}","pulls_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/pulls{/number}","milestones_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/milestones{/number}","notifications_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/labels{/name}","releases_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/releases{/id}","deployments_url":"https://api.github.com/repos/RuslanKhabibullin/intern_project/deployments","created_at":"2016-10-26T09:32:54Z","updated_at":"2016-10-26T09:34:38Z","pushed_at":"2016-11-14T18:42:22Z","git_url":"git://github.com/RuslanKhabibullin/intern_project.git","ssh_url":"git@github.com:RuslanKhabibullin/intern_project.git","clone_url":"https://github.com/RuslanKhabibullin/intern_project.git","svn_url":"https://github.com/RuslanKhabibullin/intern_project","homepage":null,"size":133,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/RuslanKhabibullin/intern_project/pulls/3"},"html":{"href":"https://github.com/RuslanKhabibullin/intern_project/pull/3"},"issue":{"href":"https://api.github.com/repos/RuslanKhabibullin/intern_project/issues/3"},"comments":{"href":"https://api.github.com/repos/RuslanKhabibullin/intern_project/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/RuslanKhabibullin/intern_project/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/RuslanKhabibullin/intern_project/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/RuslanKhabibullin/intern_project/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/RuslanKhabibullin/intern_project/statuses/43cb837f2f893dbdad7cff22db6b38e5a1cffab9"}}}}
{"actor":{"display_login":"vladimirbazhanov"}}