{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/brs_42/pulls/comments/92156452","pull_request_review_id":12664961,"id":92156452,"diff_hunk":"@@ -4,5 +4,18 @@ class Review < ApplicationRecord\n   has_many :likes, dependent: :destroy\n   has_many :comments, dependent: :destroy\n \n-  scope :updated_desc, ->{order updated_at: :desc}\n+  scope :created_desc, ->{order created_at: :desc}\n+\n+  validates :content, presence: true\n+  validates :user_id, presence: true\n+  validates :book_id, presence: true\n+\n+  def list_users_like_review\n+    user_ids = \"SELECT user_id FROM likes WHERE review_id = #{self.id}\"\n+    User.where(\"id IN (#{user_ids})\", user_ids: user_ids)","path":"app/models/review.rb","position":13,"original_position":13,"commit_id":"c4403f6791a2d04e8efca8d6cbca9809dc9eb3c8","original_commit_id":"20a6a47ef4e78e9ce13f4d23fd0aed072a792ab0","user":{"login":"lequangcanh","id":19974244,"avatar_url":"https://avatars.githubusercontent.com/u/19974244?v=3","gravatar_id":"","url":"https://api.github.com/users/lequangcanh","html_url":"https://github.com/lequangcanh","followers_url":"https://api.github.com/users/lequangcanh/followers","following_url":"https://api.github.com/users/lequangcanh/following{/other_user}","gists_url":"https://api.github.com/users/lequangcanh/gists{/gist_id}","starred_url":"https://api.github.com/users/lequangcanh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lequangcanh/subscriptions","organizations_url":"https://api.github.com/users/lequangcanh/orgs","repos_url":"https://api.github.com/users/lequangcanh/repos","events_url":"https://api.github.com/users/lequangcanh/events{/privacy}","received_events_url":"https://api.github.com/users/lequangcanh/received_events","type":"User","site_admin":false},"body":"Dạ em viết hàm này là để lấy tất cả user đã like review.\r\nVì khi gọi nó ở view sẽ dùng 1 đối tượng của Review để gọi.\r\nCòn nếu viết hàm này ở model User thì em nghĩ là phải viết class method và truyền vào 1 parameter là review","created_at":"2016-12-13T12:13:38Z","updated_at":"2016-12-13T12:13:38Z","html_url":"https://github.com/framgia/brs_42/pull/19#discussion_r92156452","pull_request_url":"https://api.github.com/repos/framgia/brs_42/pulls/19","_links":{"self":{"href":"https://api.github.com/repos/framgia/brs_42/pulls/comments/92156452"},"html":{"href":"https://github.com/framgia/brs_42/pull/19#discussion_r92156452"},"pull_request":{"href":"https://api.github.com/repos/framgia/brs_42/pulls/19"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/brs_42/pulls/19","id":97702890,"html_url":"https://github.com/framgia/brs_42/pull/19","diff_url":"https://github.com/framgia/brs_42/pull/19.diff","patch_url":"https://github.com/framgia/brs_42/pull/19.patch","issue_url":"https://api.github.com/repos/framgia/brs_42/issues/19","number":19,"state":"open","locked":false,"title":"Review book","user":{"login":"lequangcanh","id":19974244,"avatar_url":"https://avatars.githubusercontent.com/u/19974244?v=3","gravatar_id":"","url":"https://api.github.com/users/lequangcanh","html_url":"https://github.com/lequangcanh","followers_url":"https://api.github.com/users/lequangcanh/followers","following_url":"https://api.github.com/users/lequangcanh/following{/other_user}","gists_url":"https://api.github.com/users/lequangcanh/gists{/gist_id}","starred_url":"https://api.github.com/users/lequangcanh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lequangcanh/subscriptions","organizations_url":"https://api.github.com/users/lequangcanh/orgs","repos_url":"https://api.github.com/users/lequangcanh/repos","events_url":"https://api.github.com/users/lequangcanh/events{/privacy}","received_events_url":"https://api.github.com/users/lequangcanh/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-12-13T08:06:18Z","updated_at":"2016-12-13T12:13:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0e98f0122b57f274aa283a02031521bb4c44daa8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/framgia/brs_42/pulls/19/commits","review_comments_url":"https://api.github.com/repos/framgia/brs_42/pulls/19/comments","review_comment_url":"https://api.github.com/repos/framgia/brs_42/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/brs_42/issues/19/comments","statuses_url":"https://api.github.com/repos/framgia/brs_42/statuses/c4403f6791a2d04e8efca8d6cbca9809dc9eb3c8","head":{"label":"lequangcanh:review-book","ref":"review-book","sha":"c4403f6791a2d04e8efca8d6cbca9809dc9eb3c8","user":{"login":"lequangcanh","id":19974244,"avatar_url":"https://avatars.githubusercontent.com/u/19974244?v=3","gravatar_id":"","url":"https://api.github.com/users/lequangcanh","html_url":"https://github.com/lequangcanh","followers_url":"https://api.github.com/users/lequangcanh/followers","following_url":"https://api.github.com/users/lequangcanh/following{/other_user}","gists_url":"https://api.github.com/users/lequangcanh/gists{/gist_id}","starred_url":"https://api.github.com/users/lequangcanh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lequangcanh/subscriptions","organizations_url":"https://api.github.com/users/lequangcanh/orgs","repos_url":"https://api.github.com/users/lequangcanh/repos","events_url":"https://api.github.com/users/lequangcanh/events{/privacy}","received_events_url":"https://api.github.com/users/lequangcanh/received_events","type":"User","site_admin":false},"repo":{"id":75275012,"name":"brs_42","full_name":"lequangcanh/brs_42","owner":{"login":"lequangcanh","id":19974244,"avatar_url":"https://avatars.githubusercontent.com/u/19974244?v=3","gravatar_id":"","url":"https://api.github.com/users/lequangcanh","html_url":"https://github.com/lequangcanh","followers_url":"https://api.github.com/users/lequangcanh/followers","following_url":"https://api.github.com/users/lequangcanh/following{/other_user}","gists_url":"https://api.github.com/users/lequangcanh/gists{/gist_id}","starred_url":"https://api.github.com/users/lequangcanh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lequangcanh/subscriptions","organizations_url":"https://api.github.com/users/lequangcanh/orgs","repos_url":"https://api.github.com/users/lequangcanh/repos","events_url":"https://api.github.com/users/lequangcanh/events{/privacy}","received_events_url":"https://api.github.com/users/lequangcanh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lequangcanh/brs_42","description":null,"fork":true,"url":"https://api.github.com/repos/lequangcanh/brs_42","forks_url":"https://api.github.com/repos/lequangcanh/brs_42/forks","keys_url":"https://api.github.com/repos/lequangcanh/brs_42/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lequangcanh/brs_42/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lequangcanh/brs_42/teams","hooks_url":"https://api.github.com/repos/lequangcanh/brs_42/hooks","issue_events_url":"https://api.github.com/repos/lequangcanh/brs_42/issues/events{/number}","events_url":"https://api.github.com/repos/lequangcanh/brs_42/events","assignees_url":"https://api.github.com/repos/lequangcanh/brs_42/assignees{/user}","branches_url":"https://api.github.com/repos/lequangcanh/brs_42/branches{/branch}","tags_url":"https://api.github.com/repos/lequangcanh/brs_42/tags","blobs_url":"https://api.github.com/repos/lequangcanh/brs_42/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lequangcanh/brs_42/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lequangcanh/brs_42/git/refs{/sha}","trees_url":"https://api.github.com/repos/lequangcanh/brs_42/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lequangcanh/brs_42/statuses/{sha}","languages_url":"https://api.github.com/repos/lequangcanh/brs_42/languages","stargazers_url":"https://api.github.com/repos/lequangcanh/brs_42/stargazers","contributors_url":"https://api.github.com/repos/lequangcanh/brs_42/contributors","subscribers_url":"https://api.github.com/repos/lequangcanh/brs_42/subscribers","subscription_url":"https://api.github.com/repos/lequangcanh/brs_42/subscription","commits_url":"https://api.github.com/repos/lequangcanh/brs_42/commits{/sha}","git_commits_url":"https://api.github.com/repos/lequangcanh/brs_42/git/commits{/sha}","comments_url":"https://api.github.com/repos/lequangcanh/brs_42/comments{/number}","issue_comment_url":"https://api.github.com/repos/lequangcanh/brs_42/issues/comments{/number}","contents_url":"https://api.github.com/repos/lequangcanh/brs_42/contents/{+path}","compare_url":"https://api.github.com/repos/lequangcanh/brs_42/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lequangcanh/brs_42/merges","archive_url":"https://api.github.com/repos/lequangcanh/brs_42/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lequangcanh/brs_42/downloads","issues_url":"https://api.github.com/repos/lequangcanh/brs_42/issues{/number}","pulls_url":"https://api.github.com/repos/lequangcanh/brs_42/pulls{/number}","milestones_url":"https://api.github.com/repos/lequangcanh/brs_42/milestones{/number}","notifications_url":"https://api.github.com/repos/lequangcanh/brs_42/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lequangcanh/brs_42/labels{/name}","releases_url":"https://api.github.com/repos/lequangcanh/brs_42/releases{/id}","deployments_url":"https://api.github.com/repos/lequangcanh/brs_42/deployments","created_at":"2016-12-01T09:09:56Z","updated_at":"2016-12-05T08:55:10Z","pushed_at":"2016-12-13T12:07:31Z","git_url":"git://github.com/lequangcanh/brs_42.git","ssh_url":"git@github.com:lequangcanh/brs_42.git","clone_url":"https://github.com/lequangcanh/brs_42.git","svn_url":"https://github.com/lequangcanh/brs_42","homepage":null,"size":231,"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":"develop"}},"base":{"label":"framgia:develop","ref":"develop","sha":"42303000e520ec83484135e4e5d3e407d6c80737","user":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"repo":{"id":75271845,"name":"brs_42","full_name":"framgia/brs_42","owner":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/framgia/brs_42","description":null,"fork":false,"url":"https://api.github.com/repos/framgia/brs_42","forks_url":"https://api.github.com/repos/framgia/brs_42/forks","keys_url":"https://api.github.com/repos/framgia/brs_42/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/brs_42/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/brs_42/teams","hooks_url":"https://api.github.com/repos/framgia/brs_42/hooks","issue_events_url":"https://api.github.com/repos/framgia/brs_42/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/brs_42/events","assignees_url":"https://api.github.com/repos/framgia/brs_42/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/brs_42/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/brs_42/tags","blobs_url":"https://api.github.com/repos/framgia/brs_42/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/brs_42/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/brs_42/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/brs_42/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/brs_42/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/brs_42/languages","stargazers_url":"https://api.github.com/repos/framgia/brs_42/stargazers","contributors_url":"https://api.github.com/repos/framgia/brs_42/contributors","subscribers_url":"https://api.github.com/repos/framgia/brs_42/subscribers","subscription_url":"https://api.github.com/repos/framgia/brs_42/subscription","commits_url":"https://api.github.com/repos/framgia/brs_42/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/brs_42/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/brs_42/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/brs_42/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/brs_42/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/brs_42/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/brs_42/merges","archive_url":"https://api.github.com/repos/framgia/brs_42/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/brs_42/downloads","issues_url":"https://api.github.com/repos/framgia/brs_42/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/brs_42/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/brs_42/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/brs_42/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/brs_42/labels{/name}","releases_url":"https://api.github.com/repos/framgia/brs_42/releases{/id}","deployments_url":"https://api.github.com/repos/framgia/brs_42/deployments","created_at":"2016-12-01T08:30:31Z","updated_at":"2016-12-02T05:04:47Z","pushed_at":"2016-12-13T12:07:31Z","git_url":"git://github.com/framgia/brs_42.git","ssh_url":"git@github.com:framgia/brs_42.git","clone_url":"https://github.com/framgia/brs_42.git","svn_url":"https://github.com/framgia/brs_42","homepage":null,"size":240,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":4,"forks":3,"open_issues":4,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/brs_42/pulls/19"},"html":{"href":"https://github.com/framgia/brs_42/pull/19"},"issue":{"href":"https://api.github.com/repos/framgia/brs_42/issues/19"},"comments":{"href":"https://api.github.com/repos/framgia/brs_42/issues/19/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/brs_42/pulls/19/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/brs_42/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/brs_42/pulls/19/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/brs_42/statuses/c4403f6791a2d04e8efca8d6cbca9809dc9eb3c8"}}}}
{"actor":{"display_login":"lequangcanh"}}