{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/management_devise_01/pulls/comments/124777764","pull_request_review_id":47098794,"id":124777764,"diff_hunk":"@@ -147,11 +147,25 @@ def check_permision\n     redirect_to root_url unless current_user.can_manage_device\n   end\n \n-  def set_is_barcode\n-    if params[:printed_code] == \"barcode\"\n-      params[:device][:is_barcode] = true\n-    else\n-      params[:device][:is_barcode] = false\n+  def handle_is_barcode_params\n+    params[:device][:is_barcode] = params[:printed_code] == \"barcode\"\n+  end\n+\n+  def init_new_device\n+    @device = Device.new\n+    return if params[:device_id].blank?\n+\n+    load_old_device\n+    if @old_device.present?\n+      @device = @old_device.dup\n+      @device_group = @old_device.device_category.device_group\n     end\n   end\n+\n+  def load_old_device\n+    @old_device = Device.find_by id: params[:device_id]\n+    return if @old_device\n+    flash[:danger] = t(\"device_manager.copy_device_action.fail\")","path":"app/controllers/devices_controller.rb","position":63,"original_position":63,"commit_id":"57427e8564724e57a9b24886376546b6f034974a","original_commit_id":"57427e8564724e57a9b24886376546b6f034974a","user":{"login":"hungnh103","id":22311747,"avatar_url":"https://avatars3.githubusercontent.com/u/22311747?v=3","gravatar_id":"","url":"https://api.github.com/users/hungnh103","html_url":"https://github.com/hungnh103","followers_url":"https://api.github.com/users/hungnh103/followers","following_url":"https://api.github.com/users/hungnh103/following{/other_user}","gists_url":"https://api.github.com/users/hungnh103/gists{/gist_id}","starred_url":"https://api.github.com/users/hungnh103/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hungnh103/subscriptions","organizations_url":"https://api.github.com/users/hungnh103/orgs","repos_url":"https://api.github.com/users/hungnh103/repos","events_url":"https://api.github.com/users/hungnh103/events{/privacy}","received_events_url":"https://api.github.com/users/hungnh103/received_events","type":"User","site_admin":false},"body":"remove `()`","created_at":"2017-06-29T11:46:09Z","updated_at":"2017-06-29T11:50:52Z","html_url":"https://github.com/framgia/management_devise_01/pull/224#discussion_r124777764","pull_request_url":"https://api.github.com/repos/framgia/management_devise_01/pulls/224","_links":{"self":{"href":"https://api.github.com/repos/framgia/management_devise_01/pulls/comments/124777764"},"html":{"href":"https://github.com/framgia/management_devise_01/pull/224#discussion_r124777764"},"pull_request":{"href":"https://api.github.com/repos/framgia/management_devise_01/pulls/224"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/management_devise_01/pulls/224","id":127875607,"html_url":"https://github.com/framgia/management_devise_01/pull/224","diff_url":"https://github.com/framgia/management_devise_01/pull/224.diff","patch_url":"https://github.com/framgia/management_devise_01/pull/224.patch","issue_url":"https://api.github.com/repos/framgia/management_devise_01/issues/224","number":224,"state":"open","locked":false,"title":"clipboard-new-request","user":{"login":"vuductuyen","id":26272336,"avatar_url":"https://avatars1.githubusercontent.com/u/26272336?v=3","gravatar_id":"","url":"https://api.github.com/users/vuductuyen","html_url":"https://github.com/vuductuyen","followers_url":"https://api.github.com/users/vuductuyen/followers","following_url":"https://api.github.com/users/vuductuyen/following{/other_user}","gists_url":"https://api.github.com/users/vuductuyen/gists{/gist_id}","starred_url":"https://api.github.com/users/vuductuyen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vuductuyen/subscriptions","organizations_url":"https://api.github.com/users/vuductuyen/orgs","repos_url":"https://api.github.com/users/vuductuyen/repos","events_url":"https://api.github.com/users/vuductuyen/events{/privacy}","received_events_url":"https://api.github.com/users/vuductuyen/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-06-28T09:10:52Z","updated_at":"2017-06-29T11:50:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"11f76b787c7edd2123e2e150823eec657fb811ff","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/framgia/management_devise_01/pulls/224/commits","review_comments_url":"https://api.github.com/repos/framgia/management_devise_01/pulls/224/comments","review_comment_url":"https://api.github.com/repos/framgia/management_devise_01/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/management_devise_01/issues/224/comments","statuses_url":"https://api.github.com/repos/framgia/management_devise_01/statuses/57427e8564724e57a9b24886376546b6f034974a","head":{"label":"vuductuyen:copy-and-create-new-device","ref":"copy-and-create-new-device","sha":"57427e8564724e57a9b24886376546b6f034974a","user":{"login":"vuductuyen","id":26272336,"avatar_url":"https://avatars1.githubusercontent.com/u/26272336?v=3","gravatar_id":"","url":"https://api.github.com/users/vuductuyen","html_url":"https://github.com/vuductuyen","followers_url":"https://api.github.com/users/vuductuyen/followers","following_url":"https://api.github.com/users/vuductuyen/following{/other_user}","gists_url":"https://api.github.com/users/vuductuyen/gists{/gist_id}","starred_url":"https://api.github.com/users/vuductuyen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vuductuyen/subscriptions","organizations_url":"https://api.github.com/users/vuductuyen/orgs","repos_url":"https://api.github.com/users/vuductuyen/repos","events_url":"https://api.github.com/users/vuductuyen/events{/privacy}","received_events_url":"https://api.github.com/users/vuductuyen/received_events","type":"User","site_admin":false},"repo":{"id":95421435,"name":"management_devise_01","full_name":"vuductuyen/management_devise_01","owner":{"login":"vuductuyen","id":26272336,"avatar_url":"https://avatars1.githubusercontent.com/u/26272336?v=3","gravatar_id":"","url":"https://api.github.com/users/vuductuyen","html_url":"https://github.com/vuductuyen","followers_url":"https://api.github.com/users/vuductuyen/followers","following_url":"https://api.github.com/users/vuductuyen/following{/other_user}","gists_url":"https://api.github.com/users/vuductuyen/gists{/gist_id}","starred_url":"https://api.github.com/users/vuductuyen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vuductuyen/subscriptions","organizations_url":"https://api.github.com/users/vuductuyen/orgs","repos_url":"https://api.github.com/users/vuductuyen/repos","events_url":"https://api.github.com/users/vuductuyen/events{/privacy}","received_events_url":"https://api.github.com/users/vuductuyen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vuductuyen/management_devise_01","description":null,"fork":true,"url":"https://api.github.com/repos/vuductuyen/management_devise_01","forks_url":"https://api.github.com/repos/vuductuyen/management_devise_01/forks","keys_url":"https://api.github.com/repos/vuductuyen/management_devise_01/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vuductuyen/management_devise_01/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vuductuyen/management_devise_01/teams","hooks_url":"https://api.github.com/repos/vuductuyen/management_devise_01/hooks","issue_events_url":"https://api.github.com/repos/vuductuyen/management_devise_01/issues/events{/number}","events_url":"https://api.github.com/repos/vuductuyen/management_devise_01/events","assignees_url":"https://api.github.com/repos/vuductuyen/management_devise_01/assignees{/user}","branches_url":"https://api.github.com/repos/vuductuyen/management_devise_01/branches{/branch}","tags_url":"https://api.github.com/repos/vuductuyen/management_devise_01/tags","blobs_url":"https://api.github.com/repos/vuductuyen/management_devise_01/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vuductuyen/management_devise_01/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vuductuyen/management_devise_01/git/refs{/sha}","trees_url":"https://api.github.com/repos/vuductuyen/management_devise_01/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vuductuyen/management_devise_01/statuses/{sha}","languages_url":"https://api.github.com/repos/vuductuyen/management_devise_01/languages","stargazers_url":"https://api.github.com/repos/vuductuyen/management_devise_01/stargazers","contributors_url":"https://api.github.com/repos/vuductuyen/management_devise_01/contributors","subscribers_url":"https://api.github.com/repos/vuductuyen/management_devise_01/subscribers","subscription_url":"https://api.github.com/repos/vuductuyen/management_devise_01/subscription","commits_url":"https://api.github.com/repos/vuductuyen/management_devise_01/commits{/sha}","git_commits_url":"https://api.github.com/repos/vuductuyen/management_devise_01/git/commits{/sha}","comments_url":"https://api.github.com/repos/vuductuyen/management_devise_01/comments{/number}","issue_comment_url":"https://api.github.com/repos/vuductuyen/management_devise_01/issues/comments{/number}","contents_url":"https://api.github.com/repos/vuductuyen/management_devise_01/contents/{+path}","compare_url":"https://api.github.com/repos/vuductuyen/management_devise_01/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vuductuyen/management_devise_01/merges","archive_url":"https://api.github.com/repos/vuductuyen/management_devise_01/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vuductuyen/management_devise_01/downloads","issues_url":"https://api.github.com/repos/vuductuyen/management_devise_01/issues{/number}","pulls_url":"https://api.github.com/repos/vuductuyen/management_devise_01/pulls{/number}","milestones_url":"https://api.github.com/repos/vuductuyen/management_devise_01/milestones{/number}","notifications_url":"https://api.github.com/repos/vuductuyen/management_devise_01/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vuductuyen/management_devise_01/labels{/name}","releases_url":"https://api.github.com/repos/vuductuyen/management_devise_01/releases{/id}","deployments_url":"https://api.github.com/repos/vuductuyen/management_devise_01/deployments","created_at":"2017-06-26T07:42:30Z","updated_at":"2017-06-26T07:42:32Z","pushed_at":"2017-06-29T06:42:16Z","git_url":"git://github.com/vuductuyen/management_devise_01.git","ssh_url":"git@github.com:vuductuyen/management_devise_01.git","clone_url":"https://github.com/vuductuyen/management_devise_01.git","svn_url":"https://github.com/vuductuyen/management_devise_01","homepage":null,"size":3554,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"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":"fb66224abdfa604f0aa9e5a68f375b4a3c9687e2","user":{"login":"framgia","id":2322183,"avatar_url":"https://avatars0.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":78728423,"name":"management_devise_01","full_name":"framgia/management_devise_01","owner":{"login":"framgia","id":2322183,"avatar_url":"https://avatars0.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/management_devise_01","description":null,"fork":false,"url":"https://api.github.com/repos/framgia/management_devise_01","forks_url":"https://api.github.com/repos/framgia/management_devise_01/forks","keys_url":"https://api.github.com/repos/framgia/management_devise_01/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/management_devise_01/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/management_devise_01/teams","hooks_url":"https://api.github.com/repos/framgia/management_devise_01/hooks","issue_events_url":"https://api.github.com/repos/framgia/management_devise_01/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/management_devise_01/events","assignees_url":"https://api.github.com/repos/framgia/management_devise_01/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/management_devise_01/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/management_devise_01/tags","blobs_url":"https://api.github.com/repos/framgia/management_devise_01/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/management_devise_01/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/management_devise_01/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/management_devise_01/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/management_devise_01/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/management_devise_01/languages","stargazers_url":"https://api.github.com/repos/framgia/management_devise_01/stargazers","contributors_url":"https://api.github.com/repos/framgia/management_devise_01/contributors","subscribers_url":"https://api.github.com/repos/framgia/management_devise_01/subscribers","subscription_url":"https://api.github.com/repos/framgia/management_devise_01/subscription","commits_url":"https://api.github.com/repos/framgia/management_devise_01/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/management_devise_01/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/management_devise_01/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/management_devise_01/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/management_devise_01/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/management_devise_01/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/management_devise_01/merges","archive_url":"https://api.github.com/repos/framgia/management_devise_01/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/management_devise_01/downloads","issues_url":"https://api.github.com/repos/framgia/management_devise_01/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/management_devise_01/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/management_devise_01/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/management_devise_01/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/management_devise_01/labels{/name}","releases_url":"https://api.github.com/repos/framgia/management_devise_01/releases{/id}","deployments_url":"https://api.github.com/repos/framgia/management_devise_01/deployments","created_at":"2017-01-12T09:24:48Z","updated_at":"2017-02-16T13:24:43Z","pushed_at":"2017-06-29T11:30:00Z","git_url":"git://github.com/framgia/management_devise_01.git","ssh_url":"git@github.com:framgia/management_devise_01.git","clone_url":"https://github.com/framgia/management_devise_01.git","svn_url":"https://github.com/framgia/management_devise_01","homepage":null,"size":3542,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":6,"forks":20,"open_issues":6,"watchers":2,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/management_devise_01/pulls/224"},"html":{"href":"https://github.com/framgia/management_devise_01/pull/224"},"issue":{"href":"https://api.github.com/repos/framgia/management_devise_01/issues/224"},"comments":{"href":"https://api.github.com/repos/framgia/management_devise_01/issues/224/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/management_devise_01/pulls/224/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/management_devise_01/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/management_devise_01/pulls/224/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/management_devise_01/statuses/57427e8564724e57a9b24886376546b6f034974a"}}}}
{"actor":{"display_login":"hungnh103"}}