{"action":"created","comment":{"url":"https://api.github.com/repos/awesome-academy/ffd22/pulls/comments/278790596","pull_request_review_id":230957787,"id":278790596,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI3ODc5MDU5Ng==","diff_hunk":"@@ -0,0 +1,31 @@\n+class CartsController < ApplicationController\n+  require \"json\"\n+  before_action :logged_in_user, :load_cart_products,\n+    only: %i(create show)\n+\n+  def create\n+    @cart_products.merge!(item)\n+    cookies.permanent[current_user.id] = JSON.generate(@cart_products)\n+    respond_to do |format|\n+      format.html{redirect_to root_path}\n+      format.js\n+    end\n+  end\n+\n+  def show; end\n+\n+  private\n+\n+  def load_cart_products\n+    @cart_products = cart_products\n+  end\n+\n+  def item\n+    product_id = params[:cart][:product_id]\n+    quantity = params[:cart][:quantity]\n+    if @cart_products.present?\n+      quantity = @cart_products[product_id].to_i + quantity.to_i\n+    end\n+    {product_id => quantity}","path":"app/controllers/carts_controller.rb","position":29,"original_position":29,"commit_id":"c2fba3ba2be74b47f891582f491aa1c643d99804","original_commit_id":"c2fba3ba2be74b47f891582f491aa1c643d99804","user":{"login":"luat1203","id":20609495,"node_id":"MDQ6VXNlcjIwNjA5NDk1","avatar_url":"https://avatars0.githubusercontent.com/u/20609495?v=4","gravatar_id":"","url":"https://api.github.com/users/luat1203","html_url":"https://github.com/luat1203","followers_url":"https://api.github.com/users/luat1203/followers","following_url":"https://api.github.com/users/luat1203/following{/other_user}","gists_url":"https://api.github.com/users/luat1203/gists{/gist_id}","starred_url":"https://api.github.com/users/luat1203/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luat1203/subscriptions","organizations_url":"https://api.github.com/users/luat1203/orgs","repos_url":"https://api.github.com/users/luat1203/repos","events_url":"https://api.github.com/users/luat1203/events{/privacy}","received_events_url":"https://api.github.com/users/luat1203/received_events","type":"User","site_admin":false},"body":"Dạ không chị. Do cái product_id là biến","created_at":"2019-04-26T02:24:00Z","updated_at":"2019-04-26T02:24:00Z","html_url":"https://github.com/awesome-academy/ffd22/pull/18#discussion_r278790596","pull_request_url":"https://api.github.com/repos/awesome-academy/ffd22/pulls/18","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/awesome-academy/ffd22/pulls/comments/278790596"},"html":{"href":"https://github.com/awesome-academy/ffd22/pull/18#discussion_r278790596"},"pull_request":{"href":"https://api.github.com/repos/awesome-academy/ffd22/pulls/18"}},"in_reply_to_id":278785708},"pull_request":{"url":"https://api.github.com/repos/awesome-academy/ffd22/pulls/18","id":273362662,"node_id":"MDExOlB1bGxSZXF1ZXN0MjczMzYyNjYy","html_url":"https://github.com/awesome-academy/ffd22/pull/18","diff_url":"https://github.com/awesome-academy/ffd22/pull/18.diff","patch_url":"https://github.com/awesome-academy/ffd22/pull/18.patch","issue_url":"https://api.github.com/repos/awesome-academy/ffd22/issues/18","number":18,"state":"open","locked":false,"title":"Add products and show cart Task #11288","user":{"login":"luat1203","id":20609495,"node_id":"MDQ6VXNlcjIwNjA5NDk1","avatar_url":"https://avatars0.githubusercontent.com/u/20609495?v=4","gravatar_id":"","url":"https://api.github.com/users/luat1203","html_url":"https://github.com/luat1203","followers_url":"https://api.github.com/users/luat1203/followers","following_url":"https://api.github.com/users/luat1203/following{/other_user}","gists_url":"https://api.github.com/users/luat1203/gists{/gist_id}","starred_url":"https://api.github.com/users/luat1203/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luat1203/subscriptions","organizations_url":"https://api.github.com/users/luat1203/orgs","repos_url":"https://api.github.com/users/luat1203/repos","events_url":"https://api.github.com/users/luat1203/events{/privacy}","received_events_url":"https://api.github.com/users/luat1203/received_events","type":"User","site_admin":false},"body":"![image](https://user-images.githubusercontent.com/20609495/56707307-7e8a3500-6742-11e9-9c3a-6cb30793234b.png)\r\n","created_at":"2019-04-25T03:11:33Z","updated_at":"2019-04-26T02:24:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e6eb48069b8425aec9d42cb487a3fcc8cd61a404","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/awesome-academy/ffd22/pulls/18/commits","review_comments_url":"https://api.github.com/repos/awesome-academy/ffd22/pulls/18/comments","review_comment_url":"https://api.github.com/repos/awesome-academy/ffd22/pulls/comments{/number}","comments_url":"https://api.github.com/repos/awesome-academy/ffd22/issues/18/comments","statuses_url":"https://api.github.com/repos/awesome-academy/ffd22/statuses/c2fba3ba2be74b47f891582f491aa1c643d99804","head":{"label":"luat1203:cart_create_show_11288","ref":"cart_create_show_11288","sha":"c2fba3ba2be74b47f891582f491aa1c643d99804","user":{"login":"luat1203","id":20609495,"node_id":"MDQ6VXNlcjIwNjA5NDk1","avatar_url":"https://avatars0.githubusercontent.com/u/20609495?v=4","gravatar_id":"","url":"https://api.github.com/users/luat1203","html_url":"https://github.com/luat1203","followers_url":"https://api.github.com/users/luat1203/followers","following_url":"https://api.github.com/users/luat1203/following{/other_user}","gists_url":"https://api.github.com/users/luat1203/gists{/gist_id}","starred_url":"https://api.github.com/users/luat1203/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luat1203/subscriptions","organizations_url":"https://api.github.com/users/luat1203/orgs","repos_url":"https://api.github.com/users/luat1203/repos","events_url":"https://api.github.com/users/luat1203/events{/privacy}","received_events_url":"https://api.github.com/users/luat1203/received_events","type":"User","site_admin":false},"repo":{"id":180266380,"node_id":"MDEwOlJlcG9zaXRvcnkxODAyNjYzODA=","name":"ffd22","full_name":"luat1203/ffd22","private":false,"owner":{"login":"luat1203","id":20609495,"node_id":"MDQ6VXNlcjIwNjA5NDk1","avatar_url":"https://avatars0.githubusercontent.com/u/20609495?v=4","gravatar_id":"","url":"https://api.github.com/users/luat1203","html_url":"https://github.com/luat1203","followers_url":"https://api.github.com/users/luat1203/followers","following_url":"https://api.github.com/users/luat1203/following{/other_user}","gists_url":"https://api.github.com/users/luat1203/gists{/gist_id}","starred_url":"https://api.github.com/users/luat1203/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luat1203/subscriptions","organizations_url":"https://api.github.com/users/luat1203/orgs","repos_url":"https://api.github.com/users/luat1203/repos","events_url":"https://api.github.com/users/luat1203/events{/privacy}","received_events_url":"https://api.github.com/users/luat1203/received_events","type":"User","site_admin":false},"html_url":"https://github.com/luat1203/ffd22","description":null,"fork":true,"url":"https://api.github.com/repos/luat1203/ffd22","forks_url":"https://api.github.com/repos/luat1203/ffd22/forks","keys_url":"https://api.github.com/repos/luat1203/ffd22/keys{/key_id}","collaborators_url":"https://api.github.com/repos/luat1203/ffd22/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/luat1203/ffd22/teams","hooks_url":"https://api.github.com/repos/luat1203/ffd22/hooks","issue_events_url":"https://api.github.com/repos/luat1203/ffd22/issues/events{/number}","events_url":"https://api.github.com/repos/luat1203/ffd22/events","assignees_url":"https://api.github.com/repos/luat1203/ffd22/assignees{/user}","branches_url":"https://api.github.com/repos/luat1203/ffd22/branches{/branch}","tags_url":"https://api.github.com/repos/luat1203/ffd22/tags","blobs_url":"https://api.github.com/repos/luat1203/ffd22/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/luat1203/ffd22/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/luat1203/ffd22/git/refs{/sha}","trees_url":"https://api.github.com/repos/luat1203/ffd22/git/trees{/sha}","statuses_url":"https://api.github.com/repos/luat1203/ffd22/statuses/{sha}","languages_url":"https://api.github.com/repos/luat1203/ffd22/languages","stargazers_url":"https://api.github.com/repos/luat1203/ffd22/stargazers","contributors_url":"https://api.github.com/repos/luat1203/ffd22/contributors","subscribers_url":"https://api.github.com/repos/luat1203/ffd22/subscribers","subscription_url":"https://api.github.com/repos/luat1203/ffd22/subscription","commits_url":"https://api.github.com/repos/luat1203/ffd22/commits{/sha}","git_commits_url":"https://api.github.com/repos/luat1203/ffd22/git/commits{/sha}","comments_url":"https://api.github.com/repos/luat1203/ffd22/comments{/number}","issue_comment_url":"https://api.github.com/repos/luat1203/ffd22/issues/comments{/number}","contents_url":"https://api.github.com/repos/luat1203/ffd22/contents/{+path}","compare_url":"https://api.github.com/repos/luat1203/ffd22/compare/{base}...{head}","merges_url":"https://api.github.com/repos/luat1203/ffd22/merges","archive_url":"https://api.github.com/repos/luat1203/ffd22/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/luat1203/ffd22/downloads","issues_url":"https://api.github.com/repos/luat1203/ffd22/issues{/number}","pulls_url":"https://api.github.com/repos/luat1203/ffd22/pulls{/number}","milestones_url":"https://api.github.com/repos/luat1203/ffd22/milestones{/number}","notifications_url":"https://api.github.com/repos/luat1203/ffd22/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/luat1203/ffd22/labels{/name}","releases_url":"https://api.github.com/repos/luat1203/ffd22/releases{/id}","deployments_url":"https://api.github.com/repos/luat1203/ffd22/deployments","created_at":"2019-04-09T02:10:11Z","updated_at":"2019-04-09T02:10:13Z","pushed_at":"2019-04-25T04:30:36Z","git_url":"git://github.com/luat1203/ffd22.git","ssh_url":"git@github.com:luat1203/ffd22.git","clone_url":"https://github.com/luat1203/ffd22.git","svn_url":"https://github.com/luat1203/ffd22","homepage":null,"size":1719,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"awesome-academy:develop","ref":"develop","sha":"2b2dfe1fb5aa8b46bdc0a7544fecf8dce4b8d9e8","user":{"login":"awesome-academy","id":33895223,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzODk1MjIz","avatar_url":"https://avatars0.githubusercontent.com/u/33895223?v=4","gravatar_id":"","url":"https://api.github.com/users/awesome-academy","html_url":"https://github.com/awesome-academy","followers_url":"https://api.github.com/users/awesome-academy/followers","following_url":"https://api.github.com/users/awesome-academy/following{/other_user}","gists_url":"https://api.github.com/users/awesome-academy/gists{/gist_id}","starred_url":"https://api.github.com/users/awesome-academy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awesome-academy/subscriptions","organizations_url":"https://api.github.com/users/awesome-academy/orgs","repos_url":"https://api.github.com/users/awesome-academy/repos","events_url":"https://api.github.com/users/awesome-academy/events{/privacy}","received_events_url":"https://api.github.com/users/awesome-academy/received_events","type":"Organization","site_admin":false},"repo":{"id":180049658,"node_id":"MDEwOlJlcG9zaXRvcnkxODAwNDk2NTg=","name":"ffd22","full_name":"awesome-academy/ffd22","private":false,"owner":{"login":"awesome-academy","id":33895223,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzODk1MjIz","avatar_url":"https://avatars0.githubusercontent.com/u/33895223?v=4","gravatar_id":"","url":"https://api.github.com/users/awesome-academy","html_url":"https://github.com/awesome-academy","followers_url":"https://api.github.com/users/awesome-academy/followers","following_url":"https://api.github.com/users/awesome-academy/following{/other_user}","gists_url":"https://api.github.com/users/awesome-academy/gists{/gist_id}","starred_url":"https://api.github.com/users/awesome-academy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awesome-academy/subscriptions","organizations_url":"https://api.github.com/users/awesome-academy/orgs","repos_url":"https://api.github.com/users/awesome-academy/repos","events_url":"https://api.github.com/users/awesome-academy/events{/privacy}","received_events_url":"https://api.github.com/users/awesome-academy/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/awesome-academy/ffd22","description":null,"fork":false,"url":"https://api.github.com/repos/awesome-academy/ffd22","forks_url":"https://api.github.com/repos/awesome-academy/ffd22/forks","keys_url":"https://api.github.com/repos/awesome-academy/ffd22/keys{/key_id}","collaborators_url":"https://api.github.com/repos/awesome-academy/ffd22/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/awesome-academy/ffd22/teams","hooks_url":"https://api.github.com/repos/awesome-academy/ffd22/hooks","issue_events_url":"https://api.github.com/repos/awesome-academy/ffd22/issues/events{/number}","events_url":"https://api.github.com/repos/awesome-academy/ffd22/events","assignees_url":"https://api.github.com/repos/awesome-academy/ffd22/assignees{/user}","branches_url":"https://api.github.com/repos/awesome-academy/ffd22/branches{/branch}","tags_url":"https://api.github.com/repos/awesome-academy/ffd22/tags","blobs_url":"https://api.github.com/repos/awesome-academy/ffd22/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/awesome-academy/ffd22/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/awesome-academy/ffd22/git/refs{/sha}","trees_url":"https://api.github.com/repos/awesome-academy/ffd22/git/trees{/sha}","statuses_url":"https://api.github.com/repos/awesome-academy/ffd22/statuses/{sha}","languages_url":"https://api.github.com/repos/awesome-academy/ffd22/languages","stargazers_url":"https://api.github.com/repos/awesome-academy/ffd22/stargazers","contributors_url":"https://api.github.com/repos/awesome-academy/ffd22/contributors","subscribers_url":"https://api.github.com/repos/awesome-academy/ffd22/subscribers","subscription_url":"https://api.github.com/repos/awesome-academy/ffd22/subscription","commits_url":"https://api.github.com/repos/awesome-academy/ffd22/commits{/sha}","git_commits_url":"https://api.github.com/repos/awesome-academy/ffd22/git/commits{/sha}","comments_url":"https://api.github.com/repos/awesome-academy/ffd22/comments{/number}","issue_comment_url":"https://api.github.com/repos/awesome-academy/ffd22/issues/comments{/number}","contents_url":"https://api.github.com/repos/awesome-academy/ffd22/contents/{+path}","compare_url":"https://api.github.com/repos/awesome-academy/ffd22/compare/{base}...{head}","merges_url":"https://api.github.com/repos/awesome-academy/ffd22/merges","archive_url":"https://api.github.com/repos/awesome-academy/ffd22/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/awesome-academy/ffd22/downloads","issues_url":"https://api.github.com/repos/awesome-academy/ffd22/issues{/number}","pulls_url":"https://api.github.com/repos/awesome-academy/ffd22/pulls{/number}","milestones_url":"https://api.github.com/repos/awesome-academy/ffd22/milestones{/number}","notifications_url":"https://api.github.com/repos/awesome-academy/ffd22/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/awesome-academy/ffd22/labels{/name}","releases_url":"https://api.github.com/repos/awesome-academy/ffd22/releases{/id}","deployments_url":"https://api.github.com/repos/awesome-academy/ffd22/deployments","created_at":"2019-04-08T01:52:07Z","updated_at":"2019-04-24T07:28:41Z","pushed_at":"2019-04-25T04:30:37Z","git_url":"git://github.com/awesome-academy/ffd22.git","ssh_url":"git@github.com:awesome-academy/ffd22.git","clone_url":"https://github.com/awesome-academy/ffd22.git","svn_url":"https://github.com/awesome-academy/ffd22","homepage":null,"size":152,"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":2,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":1,"license":null,"forks":2,"open_issues":1,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/awesome-academy/ffd22/pulls/18"},"html":{"href":"https://github.com/awesome-academy/ffd22/pull/18"},"issue":{"href":"https://api.github.com/repos/awesome-academy/ffd22/issues/18"},"comments":{"href":"https://api.github.com/repos/awesome-academy/ffd22/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/awesome-academy/ffd22/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/awesome-academy/ffd22/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/awesome-academy/ffd22/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/awesome-academy/ffd22/statuses/c2fba3ba2be74b47f891582f491aa1c643d99804"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"luat1203"}}