{"action":"created","comment":{"url":"https://api.github.com/repos/leducson/sample_app/pulls/comments/210194492","pull_request_review_id":146357504,"id":210194492,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMDE5NDQ5Mg==","diff_hunk":"@@ -16,4 +17,28 @@ class User < ApplicationRecord\n   def email_downcase\n     email.downcase!\n   end\n+\n+  def self.digest string\n+    cost = BCrypt::Engine::MIN_COST || BCrypt::Engine.cost\n+    BCrypt::Password.create(string, cost: cost)\n+  end\n+\n+  # Returns a random token.\n+  def self.new_token\n+    SecureRandom.urlsafe_base64\n+  end\n+\n+  def remember\n+    self.remember_token = User.new_token\n+    update_attribute(:remember_digest, User.digest(remember_token))\n+  end\n+\n+  def authenticated? remember_token\n+    return false if remember_digest.nil?\n+    BCrypt::Password.new(remember_digest).is_password?(remember_token)\n+  end\n+\n+  def forget\n+    update_attribute(:remember_digest, nil)","path":"app/models/user.rb","position":32,"original_position":32,"commit_id":"e65b21f6351ce9b62b6858c9c1d7a977eebfb84c","original_commit_id":"16e9d78140371cdb36be2569a97baf5330a0470b","user":{"login":"leducson","id":13725027,"node_id":"MDQ6VXNlcjEzNzI1MDI3","avatar_url":"https://avatars2.githubusercontent.com/u/13725027?v=4","gravatar_id":"","url":"https://api.github.com/users/leducson","html_url":"https://github.com/leducson","followers_url":"https://api.github.com/users/leducson/followers","following_url":"https://api.github.com/users/leducson/following{/other_user}","gists_url":"https://api.github.com/users/leducson/gists{/gist_id}","starred_url":"https://api.github.com/users/leducson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leducson/subscriptions","organizations_url":"https://api.github.com/users/leducson/orgs","repos_url":"https://api.github.com/users/leducson/repos","events_url":"https://api.github.com/users/leducson/events{/privacy}","received_events_url":"https://api.github.com/users/leducson/received_events","type":"User","site_admin":false},"body":"Đây đều là những hàm dùng để update dữ liệu, có một số điểm khác nhau\r\n- update (dùng để cập nhập nguyên 1 recor theo dạng mảng vd: User.update(1, {name: ..., email: ...}))\r\n- update_attributes (cập nhập 1 lần nhiều attribute của object với điều kiện pass hêt validates)\r\n- update_attribute (chỉ cập nhập 1 attribute của object, hàm này hơi đặc biệt sẽ bỏ qua validate của object)\r\n- update_columns (cập nhập 1 lần nhiều attribute)\r\n- update column (cập nhập 1 attribute)\r\n-------------------------------------------------------------------------\r\nupdate_column và update_columns có điểm đặc biêt là không cập nhập column update_at, và sẽ không chạy callback của object\r\n","created_at":"2018-08-15T07:53:20Z","updated_at":"2018-08-15T07:53:20Z","html_url":"https://github.com/leducson/sample_app/pull/10#discussion_r210194492","pull_request_url":"https://api.github.com/repos/leducson/sample_app/pulls/10","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/leducson/sample_app/pulls/comments/210194492"},"html":{"href":"https://github.com/leducson/sample_app/pull/10#discussion_r210194492"},"pull_request":{"href":"https://api.github.com/repos/leducson/sample_app/pulls/10"}},"in_reply_to_id":210184353},"pull_request":{"url":"https://api.github.com/repos/leducson/sample_app/pulls/10","id":206885004,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA2ODg1MDA0","html_url":"https://github.com/leducson/sample_app/pull/10","diff_url":"https://github.com/leducson/sample_app/pull/10.diff","patch_url":"https://github.com/leducson/sample_app/pull/10.patch","issue_url":"https://api.github.com/repos/leducson/sample_app/issues/10","number":10,"state":"open","locked":false,"title":"Chapter 9","user":{"login":"leducson","id":13725027,"node_id":"MDQ6VXNlcjEzNzI1MDI3","avatar_url":"https://avatars2.githubusercontent.com/u/13725027?v=4","gravatar_id":"","url":"https://api.github.com/users/leducson","html_url":"https://github.com/leducson","followers_url":"https://api.github.com/users/leducson/followers","following_url":"https://api.github.com/users/leducson/following{/other_user}","gists_url":"https://api.github.com/users/leducson/gists{/gist_id}","starred_url":"https://api.github.com/users/leducson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leducson/subscriptions","organizations_url":"https://api.github.com/users/leducson/orgs","repos_url":"https://api.github.com/users/leducson/repos","events_url":"https://api.github.com/users/leducson/events{/privacy}","received_events_url":"https://api.github.com/users/leducson/received_events","type":"User","site_admin":false},"body":"![selection_015](https://user-images.githubusercontent.com/13725027/43815138-74f2bf42-9af8-11e8-8e23-01de80ebc108.png)\r\n","created_at":"2018-08-08T03:47:42Z","updated_at":"2018-08-15T07:53:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"60fc16859f4b2e44b3566f29372d80deda73a7cd","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/leducson/sample_app/pulls/10/commits","review_comments_url":"https://api.github.com/repos/leducson/sample_app/pulls/10/comments","review_comment_url":"https://api.github.com/repos/leducson/sample_app/pulls/comments{/number}","comments_url":"https://api.github.com/repos/leducson/sample_app/issues/10/comments","statuses_url":"https://api.github.com/repos/leducson/sample_app/statuses/e65b21f6351ce9b62b6858c9c1d7a977eebfb84c","head":{"label":"leducson:chapter-9","ref":"chapter-9","sha":"e65b21f6351ce9b62b6858c9c1d7a977eebfb84c","user":{"login":"leducson","id":13725027,"node_id":"MDQ6VXNlcjEzNzI1MDI3","avatar_url":"https://avatars2.githubusercontent.com/u/13725027?v=4","gravatar_id":"","url":"https://api.github.com/users/leducson","html_url":"https://github.com/leducson","followers_url":"https://api.github.com/users/leducson/followers","following_url":"https://api.github.com/users/leducson/following{/other_user}","gists_url":"https://api.github.com/users/leducson/gists{/gist_id}","starred_url":"https://api.github.com/users/leducson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leducson/subscriptions","organizations_url":"https://api.github.com/users/leducson/orgs","repos_url":"https://api.github.com/users/leducson/repos","events_url":"https://api.github.com/users/leducson/events{/privacy}","received_events_url":"https://api.github.com/users/leducson/received_events","type":"User","site_admin":false},"repo":{"id":143360412,"node_id":"MDEwOlJlcG9zaXRvcnkxNDMzNjA0MTI=","name":"sample_app","full_name":"leducson/sample_app","owner":{"login":"leducson","id":13725027,"node_id":"MDQ6VXNlcjEzNzI1MDI3","avatar_url":"https://avatars2.githubusercontent.com/u/13725027?v=4","gravatar_id":"","url":"https://api.github.com/users/leducson","html_url":"https://github.com/leducson","followers_url":"https://api.github.com/users/leducson/followers","following_url":"https://api.github.com/users/leducson/following{/other_user}","gists_url":"https://api.github.com/users/leducson/gists{/gist_id}","starred_url":"https://api.github.com/users/leducson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leducson/subscriptions","organizations_url":"https://api.github.com/users/leducson/orgs","repos_url":"https://api.github.com/users/leducson/repos","events_url":"https://api.github.com/users/leducson/events{/privacy}","received_events_url":"https://api.github.com/users/leducson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/leducson/sample_app","description":null,"fork":false,"url":"https://api.github.com/repos/leducson/sample_app","forks_url":"https://api.github.com/repos/leducson/sample_app/forks","keys_url":"https://api.github.com/repos/leducson/sample_app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/leducson/sample_app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/leducson/sample_app/teams","hooks_url":"https://api.github.com/repos/leducson/sample_app/hooks","issue_events_url":"https://api.github.com/repos/leducson/sample_app/issues/events{/number}","events_url":"https://api.github.com/repos/leducson/sample_app/events","assignees_url":"https://api.github.com/repos/leducson/sample_app/assignees{/user}","branches_url":"https://api.github.com/repos/leducson/sample_app/branches{/branch}","tags_url":"https://api.github.com/repos/leducson/sample_app/tags","blobs_url":"https://api.github.com/repos/leducson/sample_app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/leducson/sample_app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/leducson/sample_app/git/refs{/sha}","trees_url":"https://api.github.com/repos/leducson/sample_app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/leducson/sample_app/statuses/{sha}","languages_url":"https://api.github.com/repos/leducson/sample_app/languages","stargazers_url":"https://api.github.com/repos/leducson/sample_app/stargazers","contributors_url":"https://api.github.com/repos/leducson/sample_app/contributors","subscribers_url":"https://api.github.com/repos/leducson/sample_app/subscribers","subscription_url":"https://api.github.com/repos/leducson/sample_app/subscription","commits_url":"https://api.github.com/repos/leducson/sample_app/commits{/sha}","git_commits_url":"https://api.github.com/repos/leducson/sample_app/git/commits{/sha}","comments_url":"https://api.github.com/repos/leducson/sample_app/comments{/number}","issue_comment_url":"https://api.github.com/repos/leducson/sample_app/issues/comments{/number}","contents_url":"https://api.github.com/repos/leducson/sample_app/contents/{+path}","compare_url":"https://api.github.com/repos/leducson/sample_app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/leducson/sample_app/merges","archive_url":"https://api.github.com/repos/leducson/sample_app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/leducson/sample_app/downloads","issues_url":"https://api.github.com/repos/leducson/sample_app/issues{/number}","pulls_url":"https://api.github.com/repos/leducson/sample_app/pulls{/number}","milestones_url":"https://api.github.com/repos/leducson/sample_app/milestones{/number}","notifications_url":"https://api.github.com/repos/leducson/sample_app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/leducson/sample_app/labels{/name}","releases_url":"https://api.github.com/repos/leducson/sample_app/releases{/id}","deployments_url":"https://api.github.com/repos/leducson/sample_app/deployments","created_at":"2018-08-03T01:06:43Z","updated_at":"2018-08-15T02:15:47Z","pushed_at":"2018-08-15T07:03:19Z","git_url":"git://github.com/leducson/sample_app.git","ssh_url":"git@github.com:leducson/sample_app.git","clone_url":"https://github.com/leducson/sample_app.git","svn_url":"https://github.com/leducson/sample_app","homepage":null,"size":299,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":6,"license":null,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"base":{"label":"leducson:master","ref":"master","sha":"e7f078dc46ab4cdddab0cd42f0772975a9df814a","user":{"login":"leducson","id":13725027,"node_id":"MDQ6VXNlcjEzNzI1MDI3","avatar_url":"https://avatars2.githubusercontent.com/u/13725027?v=4","gravatar_id":"","url":"https://api.github.com/users/leducson","html_url":"https://github.com/leducson","followers_url":"https://api.github.com/users/leducson/followers","following_url":"https://api.github.com/users/leducson/following{/other_user}","gists_url":"https://api.github.com/users/leducson/gists{/gist_id}","starred_url":"https://api.github.com/users/leducson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leducson/subscriptions","organizations_url":"https://api.github.com/users/leducson/orgs","repos_url":"https://api.github.com/users/leducson/repos","events_url":"https://api.github.com/users/leducson/events{/privacy}","received_events_url":"https://api.github.com/users/leducson/received_events","type":"User","site_admin":false},"repo":{"id":143360412,"node_id":"MDEwOlJlcG9zaXRvcnkxNDMzNjA0MTI=","name":"sample_app","full_name":"leducson/sample_app","owner":{"login":"leducson","id":13725027,"node_id":"MDQ6VXNlcjEzNzI1MDI3","avatar_url":"https://avatars2.githubusercontent.com/u/13725027?v=4","gravatar_id":"","url":"https://api.github.com/users/leducson","html_url":"https://github.com/leducson","followers_url":"https://api.github.com/users/leducson/followers","following_url":"https://api.github.com/users/leducson/following{/other_user}","gists_url":"https://api.github.com/users/leducson/gists{/gist_id}","starred_url":"https://api.github.com/users/leducson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leducson/subscriptions","organizations_url":"https://api.github.com/users/leducson/orgs","repos_url":"https://api.github.com/users/leducson/repos","events_url":"https://api.github.com/users/leducson/events{/privacy}","received_events_url":"https://api.github.com/users/leducson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/leducson/sample_app","description":null,"fork":false,"url":"https://api.github.com/repos/leducson/sample_app","forks_url":"https://api.github.com/repos/leducson/sample_app/forks","keys_url":"https://api.github.com/repos/leducson/sample_app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/leducson/sample_app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/leducson/sample_app/teams","hooks_url":"https://api.github.com/repos/leducson/sample_app/hooks","issue_events_url":"https://api.github.com/repos/leducson/sample_app/issues/events{/number}","events_url":"https://api.github.com/repos/leducson/sample_app/events","assignees_url":"https://api.github.com/repos/leducson/sample_app/assignees{/user}","branches_url":"https://api.github.com/repos/leducson/sample_app/branches{/branch}","tags_url":"https://api.github.com/repos/leducson/sample_app/tags","blobs_url":"https://api.github.com/repos/leducson/sample_app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/leducson/sample_app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/leducson/sample_app/git/refs{/sha}","trees_url":"https://api.github.com/repos/leducson/sample_app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/leducson/sample_app/statuses/{sha}","languages_url":"https://api.github.com/repos/leducson/sample_app/languages","stargazers_url":"https://api.github.com/repos/leducson/sample_app/stargazers","contributors_url":"https://api.github.com/repos/leducson/sample_app/contributors","subscribers_url":"https://api.github.com/repos/leducson/sample_app/subscribers","subscription_url":"https://api.github.com/repos/leducson/sample_app/subscription","commits_url":"https://api.github.com/repos/leducson/sample_app/commits{/sha}","git_commits_url":"https://api.github.com/repos/leducson/sample_app/git/commits{/sha}","comments_url":"https://api.github.com/repos/leducson/sample_app/comments{/number}","issue_comment_url":"https://api.github.com/repos/leducson/sample_app/issues/comments{/number}","contents_url":"https://api.github.com/repos/leducson/sample_app/contents/{+path}","compare_url":"https://api.github.com/repos/leducson/sample_app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/leducson/sample_app/merges","archive_url":"https://api.github.com/repos/leducson/sample_app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/leducson/sample_app/downloads","issues_url":"https://api.github.com/repos/leducson/sample_app/issues{/number}","pulls_url":"https://api.github.com/repos/leducson/sample_app/pulls{/number}","milestones_url":"https://api.github.com/repos/leducson/sample_app/milestones{/number}","notifications_url":"https://api.github.com/repos/leducson/sample_app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/leducson/sample_app/labels{/name}","releases_url":"https://api.github.com/repos/leducson/sample_app/releases{/id}","deployments_url":"https://api.github.com/repos/leducson/sample_app/deployments","created_at":"2018-08-03T01:06:43Z","updated_at":"2018-08-15T02:15:47Z","pushed_at":"2018-08-15T07:03:19Z","git_url":"git://github.com/leducson/sample_app.git","ssh_url":"git@github.com:leducson/sample_app.git","clone_url":"https://github.com/leducson/sample_app.git","svn_url":"https://github.com/leducson/sample_app","homepage":null,"size":299,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":6,"license":null,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/leducson/sample_app/pulls/10"},"html":{"href":"https://github.com/leducson/sample_app/pull/10"},"issue":{"href":"https://api.github.com/repos/leducson/sample_app/issues/10"},"comments":{"href":"https://api.github.com/repos/leducson/sample_app/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/leducson/sample_app/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/leducson/sample_app/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/leducson/sample_app/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/leducson/sample_app/statuses/e65b21f6351ce9b62b6858c9c1d7a977eebfb84c"}},"author_association":"OWNER"}}
{"actor":{"display_login":"leducson"}}