{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/tms_25/pulls/comments/30121176","id":30121176,"diff_hunk":"@@ -0,0 +1,39 @@\n+module SessionsHelper\n+  def log_in user\n+    session[:user_id] = user.id\n+  end\n+\n+  def remember user\n+    user.remember\n+    cookies.permanent.signed[:user_id] = user.id\n+    cookies.permanent[:remember_token] = user.remember_token\n+  end\n+\n+  def current_user\n+    if user_id = session[:user_id]\n+      @current_user ||= User.find_by id: user_id\n+    elsif user_id = cookies.signed[:user_id]\n+      user = User.find_by id: user_id\n+      if user && user.authenticated?(cookies[:remember_token])\n+        log_in user\n+        @current_user = user\n+      end\n+    end\n+  end\n+\n+  def logged_in?\n+    !current_user.nil?\n+  end\n+\n+  def forget user\n+    user.forget\n+    cookies.delete :user_id\n+    cookies.delete :remember_token\n+  end\n+\n+  def log_out\n+    forget(current_user)","path":"app/helpers/sessions_helper.rb","position":35,"original_position":35,"commit_id":"5dacce37b5e788bea714ff565fb8511c7f04a73d","original_commit_id":"5dacce37b5e788bea714ff565fb8511c7f04a73d","user":{"login":"dieunb","id":2122175,"avatar_url":"https://avatars.githubusercontent.com/u/2122175?v=3","gravatar_id":"","url":"https://api.github.com/users/dieunb","html_url":"https://github.com/dieunb","followers_url":"https://api.github.com/users/dieunb/followers","following_url":"https://api.github.com/users/dieunb/following{/other_user}","gists_url":"https://api.github.com/users/dieunb/gists{/gist_id}","starred_url":"https://api.github.com/users/dieunb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dieunb/subscriptions","organizations_url":"https://api.github.com/users/dieunb/orgs","repos_url":"https://api.github.com/users/dieunb/repos","events_url":"https://api.github.com/users/dieunb/events{/privacy}","received_events_url":"https://api.github.com/users/dieunb/received_events","type":"User","site_admin":false},"body":"remove `()`","created_at":"2015-05-12T10:26:36Z","updated_at":"2015-05-12T10:26:36Z","html_url":"https://github.com/framgia/tms_25/pull/10#discussion_r30121176","pull_request_url":"https://api.github.com/repos/framgia/tms_25/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/framgia/tms_25/pulls/comments/30121176"},"html":{"href":"https://github.com/framgia/tms_25/pull/10#discussion_r30121176"},"pull_request":{"href":"https://api.github.com/repos/framgia/tms_25/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/tms_25/pulls/10","id":35204049,"html_url":"https://github.com/framgia/tms_25/pull/10","diff_url":"https://github.com/framgia/tms_25/pull/10.diff","patch_url":"https://github.com/framgia/tms_25/pull/10.patch","issue_url":"https://api.github.com/repos/framgia/tms_25/issues/10","number":10,"state":"open","locked":false,"title":"Login / logout / remember me functions","user":{"login":"khanhkhanh","id":11971311,"avatar_url":"https://avatars.githubusercontent.com/u/11971311?v=3","gravatar_id":"","url":"https://api.github.com/users/khanhkhanh","html_url":"https://github.com/khanhkhanh","followers_url":"https://api.github.com/users/khanhkhanh/followers","following_url":"https://api.github.com/users/khanhkhanh/following{/other_user}","gists_url":"https://api.github.com/users/khanhkhanh/gists{/gist_id}","starred_url":"https://api.github.com/users/khanhkhanh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khanhkhanh/subscriptions","organizations_url":"https://api.github.com/users/khanhkhanh/orgs","repos_url":"https://api.github.com/users/khanhkhanh/repos","events_url":"https://api.github.com/users/khanhkhanh/events{/privacy}","received_events_url":"https://api.github.com/users/khanhkhanh/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-05-12T08:38:51Z","updated_at":"2015-05-12T10:26:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ea08b6f0164ddc6a7a73de1d78ec1b17699c6d7e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/framgia/tms_25/pulls/10/commits","review_comments_url":"https://api.github.com/repos/framgia/tms_25/pulls/10/comments","review_comment_url":"https://api.github.com/repos/framgia/tms_25/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/tms_25/issues/10/comments","statuses_url":"https://api.github.com/repos/framgia/tms_25/statuses/5dacce37b5e788bea714ff565fb8511c7f04a73d","head":{"label":"khanhkhanh:login_logout","ref":"login_logout","sha":"5dacce37b5e788bea714ff565fb8511c7f04a73d","user":{"login":"khanhkhanh","id":11971311,"avatar_url":"https://avatars.githubusercontent.com/u/11971311?v=3","gravatar_id":"","url":"https://api.github.com/users/khanhkhanh","html_url":"https://github.com/khanhkhanh","followers_url":"https://api.github.com/users/khanhkhanh/followers","following_url":"https://api.github.com/users/khanhkhanh/following{/other_user}","gists_url":"https://api.github.com/users/khanhkhanh/gists{/gist_id}","starred_url":"https://api.github.com/users/khanhkhanh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khanhkhanh/subscriptions","organizations_url":"https://api.github.com/users/khanhkhanh/orgs","repos_url":"https://api.github.com/users/khanhkhanh/repos","events_url":"https://api.github.com/users/khanhkhanh/events{/privacy}","received_events_url":"https://api.github.com/users/khanhkhanh/received_events","type":"User","site_admin":false},"repo":{"id":35253095,"name":"tms_25","full_name":"khanhkhanh/tms_25","owner":{"login":"khanhkhanh","id":11971311,"avatar_url":"https://avatars.githubusercontent.com/u/11971311?v=3","gravatar_id":"","url":"https://api.github.com/users/khanhkhanh","html_url":"https://github.com/khanhkhanh","followers_url":"https://api.github.com/users/khanhkhanh/followers","following_url":"https://api.github.com/users/khanhkhanh/following{/other_user}","gists_url":"https://api.github.com/users/khanhkhanh/gists{/gist_id}","starred_url":"https://api.github.com/users/khanhkhanh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khanhkhanh/subscriptions","organizations_url":"https://api.github.com/users/khanhkhanh/orgs","repos_url":"https://api.github.com/users/khanhkhanh/repos","events_url":"https://api.github.com/users/khanhkhanh/events{/privacy}","received_events_url":"https://api.github.com/users/khanhkhanh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/khanhkhanh/tms_25","description":"Framgia Training Management System","fork":true,"url":"https://api.github.com/repos/khanhkhanh/tms_25","forks_url":"https://api.github.com/repos/khanhkhanh/tms_25/forks","keys_url":"https://api.github.com/repos/khanhkhanh/tms_25/keys{/key_id}","collaborators_url":"https://api.github.com/repos/khanhkhanh/tms_25/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/khanhkhanh/tms_25/teams","hooks_url":"https://api.github.com/repos/khanhkhanh/tms_25/hooks","issue_events_url":"https://api.github.com/repos/khanhkhanh/tms_25/issues/events{/number}","events_url":"https://api.github.com/repos/khanhkhanh/tms_25/events","assignees_url":"https://api.github.com/repos/khanhkhanh/tms_25/assignees{/user}","branches_url":"https://api.github.com/repos/khanhkhanh/tms_25/branches{/branch}","tags_url":"https://api.github.com/repos/khanhkhanh/tms_25/tags","blobs_url":"https://api.github.com/repos/khanhkhanh/tms_25/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/khanhkhanh/tms_25/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/khanhkhanh/tms_25/git/refs{/sha}","trees_url":"https://api.github.com/repos/khanhkhanh/tms_25/git/trees{/sha}","statuses_url":"https://api.github.com/repos/khanhkhanh/tms_25/statuses/{sha}","languages_url":"https://api.github.com/repos/khanhkhanh/tms_25/languages","stargazers_url":"https://api.github.com/repos/khanhkhanh/tms_25/stargazers","contributors_url":"https://api.github.com/repos/khanhkhanh/tms_25/contributors","subscribers_url":"https://api.github.com/repos/khanhkhanh/tms_25/subscribers","subscription_url":"https://api.github.com/repos/khanhkhanh/tms_25/subscription","commits_url":"https://api.github.com/repos/khanhkhanh/tms_25/commits{/sha}","git_commits_url":"https://api.github.com/repos/khanhkhanh/tms_25/git/commits{/sha}","comments_url":"https://api.github.com/repos/khanhkhanh/tms_25/comments{/number}","issue_comment_url":"https://api.github.com/repos/khanhkhanh/tms_25/issues/comments{/number}","contents_url":"https://api.github.com/repos/khanhkhanh/tms_25/contents/{+path}","compare_url":"https://api.github.com/repos/khanhkhanh/tms_25/compare/{base}...{head}","merges_url":"https://api.github.com/repos/khanhkhanh/tms_25/merges","archive_url":"https://api.github.com/repos/khanhkhanh/tms_25/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/khanhkhanh/tms_25/downloads","issues_url":"https://api.github.com/repos/khanhkhanh/tms_25/issues{/number}","pulls_url":"https://api.github.com/repos/khanhkhanh/tms_25/pulls{/number}","milestones_url":"https://api.github.com/repos/khanhkhanh/tms_25/milestones{/number}","notifications_url":"https://api.github.com/repos/khanhkhanh/tms_25/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/khanhkhanh/tms_25/labels{/name}","releases_url":"https://api.github.com/repos/khanhkhanh/tms_25/releases{/id}","created_at":"2015-05-08T01:54:55Z","updated_at":"2015-04-15T03:17:52Z","pushed_at":"2015-05-12T10:21:43Z","git_url":"git://github.com/khanhkhanh/tms_25.git","ssh_url":"git@github.com:khanhkhanh/tms_25.git","clone_url":"https://github.com/khanhkhanh/tms_25.git","svn_url":"https://github.com/khanhkhanh/tms_25","homepage":null,"size":232,"stargazers_count":0,"watchers_count":0,"language":null,"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":"6aac1809ffce4a9cf090db19e6a2b5f54547e143","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":33970699,"name":"tms_25","full_name":"framgia/tms_25","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/tms_25","description":"Framgia Training Management System","fork":false,"url":"https://api.github.com/repos/framgia/tms_25","forks_url":"https://api.github.com/repos/framgia/tms_25/forks","keys_url":"https://api.github.com/repos/framgia/tms_25/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/tms_25/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/tms_25/teams","hooks_url":"https://api.github.com/repos/framgia/tms_25/hooks","issue_events_url":"https://api.github.com/repos/framgia/tms_25/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/tms_25/events","assignees_url":"https://api.github.com/repos/framgia/tms_25/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/tms_25/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/tms_25/tags","blobs_url":"https://api.github.com/repos/framgia/tms_25/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/tms_25/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/tms_25/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/tms_25/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/tms_25/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/tms_25/languages","stargazers_url":"https://api.github.com/repos/framgia/tms_25/stargazers","contributors_url":"https://api.github.com/repos/framgia/tms_25/contributors","subscribers_url":"https://api.github.com/repos/framgia/tms_25/subscribers","subscription_url":"https://api.github.com/repos/framgia/tms_25/subscription","commits_url":"https://api.github.com/repos/framgia/tms_25/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/tms_25/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/tms_25/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/tms_25/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/tms_25/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/tms_25/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/tms_25/merges","archive_url":"https://api.github.com/repos/framgia/tms_25/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/tms_25/downloads","issues_url":"https://api.github.com/repos/framgia/tms_25/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/tms_25/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/tms_25/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/tms_25/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/tms_25/labels{/name}","releases_url":"https://api.github.com/repos/framgia/tms_25/releases{/id}","created_at":"2015-04-15T03:17:52Z","updated_at":"2015-04-15T03:17:52Z","pushed_at":"2015-05-12T10:21:44Z","git_url":"git://github.com/framgia/tms_25.git","ssh_url":"git@github.com:framgia/tms_25.git","clone_url":"https://github.com/framgia/tms_25.git","svn_url":"https://github.com/framgia/tms_25","homepage":null,"size":1264,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":6,"forks":3,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/tms_25/pulls/10"},"html":{"href":"https://github.com/framgia/tms_25/pull/10"},"issue":{"href":"https://api.github.com/repos/framgia/tms_25/issues/10"},"comments":{"href":"https://api.github.com/repos/framgia/tms_25/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/tms_25/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/tms_25/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/tms_25/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/tms_25/statuses/5dacce37b5e788bea714ff565fb8511c7f04a73d"}}}}