{"action":"created","comment":{"url":"https://api.github.com/repos/khanh227/class-2/pulls/comments/280691998","pull_request_review_id":233360388,"id":280691998,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI4MDY5MTk5OA==","diff_hunk":"@@ -3,9 +3,21 @@ class ProductsController < ApplicationController\n   before_action :authenticate_user!, only:[:new, :edit]\n \n   def index\n+    respond_to do |format|\n+      format.html { display_products }\n+      format.csv { export_products }\n+    end\n+  end\n+\n+  def display_products\n     @products = Product.order(created_at: :desc)\n   end\n \n+  def export_products\n+    csv = ExportCsv.new(display_products, Product::CSV_ATTRIBUTES)\n+    send_data csv.perform, filename: \"products.csv\"","path":"app/controllers/products_controller.rb","position":16,"original_position":16,"commit_id":"4ad56c84a2621030e2becac3b21468eb91e711d3","original_commit_id":"4ad56c84a2621030e2becac3b21468eb91e711d3","user":{"login":"khanh227","id":15766927,"node_id":"MDQ6VXNlcjE1NzY2OTI3","avatar_url":"https://avatars1.githubusercontent.com/u/15766927?v=4","gravatar_id":"","url":"https://api.github.com/users/khanh227","html_url":"https://github.com/khanh227","followers_url":"https://api.github.com/users/khanh227/followers","following_url":"https://api.github.com/users/khanh227/following{/other_user}","gists_url":"https://api.github.com/users/khanh227/gists{/gist_id}","starred_url":"https://api.github.com/users/khanh227/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khanh227/subscriptions","organizations_url":"https://api.github.com/users/khanh227/orgs","repos_url":"https://api.github.com/users/khanh227/repos","events_url":"https://api.github.com/users/khanh227/events{/privacy}","received_events_url":"https://api.github.com/users/khanh227/received_events","type":"User","site_admin":false},"body":"`send_data csv, filename: 'products.csv'`","created_at":"2019-05-03T08:12:33Z","updated_at":"2019-05-03T08:12:53Z","html_url":"https://github.com/khanh227/class-2/pull/69#discussion_r280691998","pull_request_url":"https://api.github.com/repos/khanh227/class-2/pulls/69","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/khanh227/class-2/pulls/comments/280691998"},"html":{"href":"https://github.com/khanh227/class-2/pull/69#discussion_r280691998"},"pull_request":{"href":"https://api.github.com/repos/khanh227/class-2/pulls/69"}}},"pull_request":{"url":"https://api.github.com/repos/khanh227/class-2/pulls/69","id":275585393,"node_id":"MDExOlB1bGxSZXF1ZXN0Mjc1NTg1Mzkz","html_url":"https://github.com/khanh227/class-2/pull/69","diff_url":"https://github.com/khanh227/class-2/pull/69.diff","patch_url":"https://github.com/khanh227/class-2/pull/69.patch","issue_url":"https://api.github.com/repos/khanh227/class-2/issues/69","number":69,"state":"open","locked":false,"title":"Issue 5: Export Products with filter","user":{"login":"bibochip","id":12341958,"node_id":"MDQ6VXNlcjEyMzQxOTU4","avatar_url":"https://avatars2.githubusercontent.com/u/12341958?v=4","gravatar_id":"","url":"https://api.github.com/users/bibochip","html_url":"https://github.com/bibochip","followers_url":"https://api.github.com/users/bibochip/followers","following_url":"https://api.github.com/users/bibochip/following{/other_user}","gists_url":"https://api.github.com/users/bibochip/gists{/gist_id}","starred_url":"https://api.github.com/users/bibochip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bibochip/subscriptions","organizations_url":"https://api.github.com/users/bibochip/orgs","repos_url":"https://api.github.com/users/bibochip/repos","events_url":"https://api.github.com/users/bibochip/events{/privacy}","received_events_url":"https://api.github.com/users/bibochip/received_events","type":"User","site_admin":false},"body":"","created_at":"2019-05-03T03:57:34Z","updated_at":"2019-05-03T08:12:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"baa66a03a5ab81f4c3384df293c6f9a4f499fe33","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/khanh227/class-2/pulls/69/commits","review_comments_url":"https://api.github.com/repos/khanh227/class-2/pulls/69/comments","review_comment_url":"https://api.github.com/repos/khanh227/class-2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/khanh227/class-2/issues/69/comments","statuses_url":"https://api.github.com/repos/khanh227/class-2/statuses/4ad56c84a2621030e2becac3b21468eb91e711d3","head":{"label":"khanh227:Issue-5","ref":"Issue-5","sha":"4ad56c84a2621030e2becac3b21468eb91e711d3","user":{"login":"khanh227","id":15766927,"node_id":"MDQ6VXNlcjE1NzY2OTI3","avatar_url":"https://avatars1.githubusercontent.com/u/15766927?v=4","gravatar_id":"","url":"https://api.github.com/users/khanh227","html_url":"https://github.com/khanh227","followers_url":"https://api.github.com/users/khanh227/followers","following_url":"https://api.github.com/users/khanh227/following{/other_user}","gists_url":"https://api.github.com/users/khanh227/gists{/gist_id}","starred_url":"https://api.github.com/users/khanh227/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khanh227/subscriptions","organizations_url":"https://api.github.com/users/khanh227/orgs","repos_url":"https://api.github.com/users/khanh227/repos","events_url":"https://api.github.com/users/khanh227/events{/privacy}","received_events_url":"https://api.github.com/users/khanh227/received_events","type":"User","site_admin":false},"repo":{"id":181645286,"node_id":"MDEwOlJlcG9zaXRvcnkxODE2NDUyODY=","name":"class-2","full_name":"khanh227/class-2","private":false,"owner":{"login":"khanh227","id":15766927,"node_id":"MDQ6VXNlcjE1NzY2OTI3","avatar_url":"https://avatars1.githubusercontent.com/u/15766927?v=4","gravatar_id":"","url":"https://api.github.com/users/khanh227","html_url":"https://github.com/khanh227","followers_url":"https://api.github.com/users/khanh227/followers","following_url":"https://api.github.com/users/khanh227/following{/other_user}","gists_url":"https://api.github.com/users/khanh227/gists{/gist_id}","starred_url":"https://api.github.com/users/khanh227/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khanh227/subscriptions","organizations_url":"https://api.github.com/users/khanh227/orgs","repos_url":"https://api.github.com/users/khanh227/repos","events_url":"https://api.github.com/users/khanh227/events{/privacy}","received_events_url":"https://api.github.com/users/khanh227/received_events","type":"User","site_admin":false},"html_url":"https://github.com/khanh227/class-2","description":null,"fork":false,"url":"https://api.github.com/repos/khanh227/class-2","forks_url":"https://api.github.com/repos/khanh227/class-2/forks","keys_url":"https://api.github.com/repos/khanh227/class-2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/khanh227/class-2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/khanh227/class-2/teams","hooks_url":"https://api.github.com/repos/khanh227/class-2/hooks","issue_events_url":"https://api.github.com/repos/khanh227/class-2/issues/events{/number}","events_url":"https://api.github.com/repos/khanh227/class-2/events","assignees_url":"https://api.github.com/repos/khanh227/class-2/assignees{/user}","branches_url":"https://api.github.com/repos/khanh227/class-2/branches{/branch}","tags_url":"https://api.github.com/repos/khanh227/class-2/tags","blobs_url":"https://api.github.com/repos/khanh227/class-2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/khanh227/class-2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/khanh227/class-2/git/refs{/sha}","trees_url":"https://api.github.com/repos/khanh227/class-2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/khanh227/class-2/statuses/{sha}","languages_url":"https://api.github.com/repos/khanh227/class-2/languages","stargazers_url":"https://api.github.com/repos/khanh227/class-2/stargazers","contributors_url":"https://api.github.com/repos/khanh227/class-2/contributors","subscribers_url":"https://api.github.com/repos/khanh227/class-2/subscribers","subscription_url":"https://api.github.com/repos/khanh227/class-2/subscription","commits_url":"https://api.github.com/repos/khanh227/class-2/commits{/sha}","git_commits_url":"https://api.github.com/repos/khanh227/class-2/git/commits{/sha}","comments_url":"https://api.github.com/repos/khanh227/class-2/comments{/number}","issue_comment_url":"https://api.github.com/repos/khanh227/class-2/issues/comments{/number}","contents_url":"https://api.github.com/repos/khanh227/class-2/contents/{+path}","compare_url":"https://api.github.com/repos/khanh227/class-2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/khanh227/class-2/merges","archive_url":"https://api.github.com/repos/khanh227/class-2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/khanh227/class-2/downloads","issues_url":"https://api.github.com/repos/khanh227/class-2/issues{/number}","pulls_url":"https://api.github.com/repos/khanh227/class-2/pulls{/number}","milestones_url":"https://api.github.com/repos/khanh227/class-2/milestones{/number}","notifications_url":"https://api.github.com/repos/khanh227/class-2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/khanh227/class-2/labels{/name}","releases_url":"https://api.github.com/repos/khanh227/class-2/releases{/id}","deployments_url":"https://api.github.com/repos/khanh227/class-2/deployments","created_at":"2019-04-16T08:14:53Z","updated_at":"2019-05-03T03:38:25Z","pushed_at":"2019-05-03T08:05:25Z","git_url":"git://github.com/khanh227/class-2.git","ssh_url":"git@github.com:khanh227/class-2.git","clone_url":"https://github.com/khanh227/class-2.git","svn_url":"https://github.com/khanh227/class-2","homepage":null,"size":10903,"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,"disabled":false,"open_issues_count":7,"license":null,"forks":0,"open_issues":7,"watchers":0,"default_branch":"develop"}},"base":{"label":"khanh227:develop","ref":"develop","sha":"0c1a20110a751e51bca219f58dc2ea4ba0d96200","user":{"login":"khanh227","id":15766927,"node_id":"MDQ6VXNlcjE1NzY2OTI3","avatar_url":"https://avatars1.githubusercontent.com/u/15766927?v=4","gravatar_id":"","url":"https://api.github.com/users/khanh227","html_url":"https://github.com/khanh227","followers_url":"https://api.github.com/users/khanh227/followers","following_url":"https://api.github.com/users/khanh227/following{/other_user}","gists_url":"https://api.github.com/users/khanh227/gists{/gist_id}","starred_url":"https://api.github.com/users/khanh227/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khanh227/subscriptions","organizations_url":"https://api.github.com/users/khanh227/orgs","repos_url":"https://api.github.com/users/khanh227/repos","events_url":"https://api.github.com/users/khanh227/events{/privacy}","received_events_url":"https://api.github.com/users/khanh227/received_events","type":"User","site_admin":false},"repo":{"id":181645286,"node_id":"MDEwOlJlcG9zaXRvcnkxODE2NDUyODY=","name":"class-2","full_name":"khanh227/class-2","private":false,"owner":{"login":"khanh227","id":15766927,"node_id":"MDQ6VXNlcjE1NzY2OTI3","avatar_url":"https://avatars1.githubusercontent.com/u/15766927?v=4","gravatar_id":"","url":"https://api.github.com/users/khanh227","html_url":"https://github.com/khanh227","followers_url":"https://api.github.com/users/khanh227/followers","following_url":"https://api.github.com/users/khanh227/following{/other_user}","gists_url":"https://api.github.com/users/khanh227/gists{/gist_id}","starred_url":"https://api.github.com/users/khanh227/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khanh227/subscriptions","organizations_url":"https://api.github.com/users/khanh227/orgs","repos_url":"https://api.github.com/users/khanh227/repos","events_url":"https://api.github.com/users/khanh227/events{/privacy}","received_events_url":"https://api.github.com/users/khanh227/received_events","type":"User","site_admin":false},"html_url":"https://github.com/khanh227/class-2","description":null,"fork":false,"url":"https://api.github.com/repos/khanh227/class-2","forks_url":"https://api.github.com/repos/khanh227/class-2/forks","keys_url":"https://api.github.com/repos/khanh227/class-2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/khanh227/class-2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/khanh227/class-2/teams","hooks_url":"https://api.github.com/repos/khanh227/class-2/hooks","issue_events_url":"https://api.github.com/repos/khanh227/class-2/issues/events{/number}","events_url":"https://api.github.com/repos/khanh227/class-2/events","assignees_url":"https://api.github.com/repos/khanh227/class-2/assignees{/user}","branches_url":"https://api.github.com/repos/khanh227/class-2/branches{/branch}","tags_url":"https://api.github.com/repos/khanh227/class-2/tags","blobs_url":"https://api.github.com/repos/khanh227/class-2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/khanh227/class-2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/khanh227/class-2/git/refs{/sha}","trees_url":"https://api.github.com/repos/khanh227/class-2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/khanh227/class-2/statuses/{sha}","languages_url":"https://api.github.com/repos/khanh227/class-2/languages","stargazers_url":"https://api.github.com/repos/khanh227/class-2/stargazers","contributors_url":"https://api.github.com/repos/khanh227/class-2/contributors","subscribers_url":"https://api.github.com/repos/khanh227/class-2/subscribers","subscription_url":"https://api.github.com/repos/khanh227/class-2/subscription","commits_url":"https://api.github.com/repos/khanh227/class-2/commits{/sha}","git_commits_url":"https://api.github.com/repos/khanh227/class-2/git/commits{/sha}","comments_url":"https://api.github.com/repos/khanh227/class-2/comments{/number}","issue_comment_url":"https://api.github.com/repos/khanh227/class-2/issues/comments{/number}","contents_url":"https://api.github.com/repos/khanh227/class-2/contents/{+path}","compare_url":"https://api.github.com/repos/khanh227/class-2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/khanh227/class-2/merges","archive_url":"https://api.github.com/repos/khanh227/class-2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/khanh227/class-2/downloads","issues_url":"https://api.github.com/repos/khanh227/class-2/issues{/number}","pulls_url":"https://api.github.com/repos/khanh227/class-2/pulls{/number}","milestones_url":"https://api.github.com/repos/khanh227/class-2/milestones{/number}","notifications_url":"https://api.github.com/repos/khanh227/class-2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/khanh227/class-2/labels{/name}","releases_url":"https://api.github.com/repos/khanh227/class-2/releases{/id}","deployments_url":"https://api.github.com/repos/khanh227/class-2/deployments","created_at":"2019-04-16T08:14:53Z","updated_at":"2019-05-03T03:38:25Z","pushed_at":"2019-05-03T08:05:25Z","git_url":"git://github.com/khanh227/class-2.git","ssh_url":"git@github.com:khanh227/class-2.git","clone_url":"https://github.com/khanh227/class-2.git","svn_url":"https://github.com/khanh227/class-2","homepage":null,"size":10903,"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,"disabled":false,"open_issues_count":7,"license":null,"forks":0,"open_issues":7,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/khanh227/class-2/pulls/69"},"html":{"href":"https://github.com/khanh227/class-2/pull/69"},"issue":{"href":"https://api.github.com/repos/khanh227/class-2/issues/69"},"comments":{"href":"https://api.github.com/repos/khanh227/class-2/issues/69/comments"},"review_comments":{"href":"https://api.github.com/repos/khanh227/class-2/pulls/69/comments"},"review_comment":{"href":"https://api.github.com/repos/khanh227/class-2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/khanh227/class-2/pulls/69/commits"},"statuses":{"href":"https://api.github.com/repos/khanh227/class-2/statuses/4ad56c84a2621030e2becac3b21468eb91e711d3"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"khanh227"}}