{"action":"created","comment":{"url":"https://api.github.com/repos/febryhadinata/ruby-controls/pulls/comments/50538442","id":50538442,"diff_hunk":"@@ -2,4 +2,19 @@ class ApplicationController < ActionController::Base\n   # Prevent CSRF attacks by raising an exception.\n   # For APIs, you may want to use :null_session instead.\n   protect_from_forgery with: :exception\n+\n+  helper_method :current_user\n+\n+  def current_user\n+    @current_user ||= User.find(session[:user_id]) if session[:user_id]\n+  end\n+\n+  def require_user\n+    redirect_to '/login' unless current_user\n+  end\n+\n+  def require_admin\n+    redirect_to login_url unless current_user.admin?\n+  end\n+","path":"app/controllers/application_controller.rb","position":18,"original_position":18,"commit_id":"510f1121cca62223267627a452d11882424305ab","original_commit_id":"510f1121cca62223267627a452d11882424305ab","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Extra empty line detected at class body end.","created_at":"2016-01-22T13:55:43Z","updated_at":"2016-01-22T13:55:43Z","html_url":"https://github.com/febryhadinata/ruby-controls/pull/3#discussion_r50538442","pull_request_url":"https://api.github.com/repos/febryhadinata/ruby-controls/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/febryhadinata/ruby-controls/pulls/comments/50538442"},"html":{"href":"https://github.com/febryhadinata/ruby-controls/pull/3#discussion_r50538442"},"pull_request":{"href":"https://api.github.com/repos/febryhadinata/ruby-controls/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/febryhadinata/ruby-controls/pulls/3","id":56889670,"html_url":"https://github.com/febryhadinata/ruby-controls/pull/3","diff_url":"https://github.com/febryhadinata/ruby-controls/pull/3.diff","patch_url":"https://github.com/febryhadinata/ruby-controls/pull/3.patch","issue_url":"https://api.github.com/repos/febryhadinata/ruby-controls/issues/3","number":3,"state":"open","locked":false,"title":"Added Session Module","user":{"login":"febryhadinata","id":3851380,"avatar_url":"https://avatars.githubusercontent.com/u/3851380?v=3","gravatar_id":"","url":"https://api.github.com/users/febryhadinata","html_url":"https://github.com/febryhadinata","followers_url":"https://api.github.com/users/febryhadinata/followers","following_url":"https://api.github.com/users/febryhadinata/following{/other_user}","gists_url":"https://api.github.com/users/febryhadinata/gists{/gist_id}","starred_url":"https://api.github.com/users/febryhadinata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/febryhadinata/subscriptions","organizations_url":"https://api.github.com/users/febryhadinata/orgs","repos_url":"https://api.github.com/users/febryhadinata/repos","events_url":"https://api.github.com/users/febryhadinata/events{/privacy}","received_events_url":"https://api.github.com/users/febryhadinata/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-01-22T13:52:41Z","updated_at":"2016-01-22T13:55:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0c2479ce46d11e2a88c8a6463676ec151a1e45d1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/febryhadinata/ruby-controls/pulls/3/commits","review_comments_url":"https://api.github.com/repos/febryhadinata/ruby-controls/pulls/3/comments","review_comment_url":"https://api.github.com/repos/febryhadinata/ruby-controls/pulls/comments{/number}","comments_url":"https://api.github.com/repos/febryhadinata/ruby-controls/issues/3/comments","statuses_url":"https://api.github.com/repos/febryhadinata/ruby-controls/statuses/510f1121cca62223267627a452d11882424305ab","head":{"label":"febryhadinata:feature/session_module","ref":"feature/session_module","sha":"510f1121cca62223267627a452d11882424305ab","user":{"login":"febryhadinata","id":3851380,"avatar_url":"https://avatars.githubusercontent.com/u/3851380?v=3","gravatar_id":"","url":"https://api.github.com/users/febryhadinata","html_url":"https://github.com/febryhadinata","followers_url":"https://api.github.com/users/febryhadinata/followers","following_url":"https://api.github.com/users/febryhadinata/following{/other_user}","gists_url":"https://api.github.com/users/febryhadinata/gists{/gist_id}","starred_url":"https://api.github.com/users/febryhadinata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/febryhadinata/subscriptions","organizations_url":"https://api.github.com/users/febryhadinata/orgs","repos_url":"https://api.github.com/users/febryhadinata/repos","events_url":"https://api.github.com/users/febryhadinata/events{/privacy}","received_events_url":"https://api.github.com/users/febryhadinata/received_events","type":"User","site_admin":false},"repo":{"id":49876596,"name":"ruby-controls","full_name":"febryhadinata/ruby-controls","owner":{"login":"febryhadinata","id":3851380,"avatar_url":"https://avatars.githubusercontent.com/u/3851380?v=3","gravatar_id":"","url":"https://api.github.com/users/febryhadinata","html_url":"https://github.com/febryhadinata","followers_url":"https://api.github.com/users/febryhadinata/followers","following_url":"https://api.github.com/users/febryhadinata/following{/other_user}","gists_url":"https://api.github.com/users/febryhadinata/gists{/gist_id}","starred_url":"https://api.github.com/users/febryhadinata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/febryhadinata/subscriptions","organizations_url":"https://api.github.com/users/febryhadinata/orgs","repos_url":"https://api.github.com/users/febryhadinata/repos","events_url":"https://api.github.com/users/febryhadinata/events{/privacy}","received_events_url":"https://api.github.com/users/febryhadinata/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/febryhadinata/ruby-controls","description":"","fork":false,"url":"https://api.github.com/repos/febryhadinata/ruby-controls","forks_url":"https://api.github.com/repos/febryhadinata/ruby-controls/forks","keys_url":"https://api.github.com/repos/febryhadinata/ruby-controls/keys{/key_id}","collaborators_url":"https://api.github.com/repos/febryhadinata/ruby-controls/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/febryhadinata/ruby-controls/teams","hooks_url":"https://api.github.com/repos/febryhadinata/ruby-controls/hooks","issue_events_url":"https://api.github.com/repos/febryhadinata/ruby-controls/issues/events{/number}","events_url":"https://api.github.com/repos/febryhadinata/ruby-controls/events","assignees_url":"https://api.github.com/repos/febryhadinata/ruby-controls/assignees{/user}","branches_url":"https://api.github.com/repos/febryhadinata/ruby-controls/branches{/branch}","tags_url":"https://api.github.com/repos/febryhadinata/ruby-controls/tags","blobs_url":"https://api.github.com/repos/febryhadinata/ruby-controls/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/febryhadinata/ruby-controls/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/febryhadinata/ruby-controls/git/refs{/sha}","trees_url":"https://api.github.com/repos/febryhadinata/ruby-controls/git/trees{/sha}","statuses_url":"https://api.github.com/repos/febryhadinata/ruby-controls/statuses/{sha}","languages_url":"https://api.github.com/repos/febryhadinata/ruby-controls/languages","stargazers_url":"https://api.github.com/repos/febryhadinata/ruby-controls/stargazers","contributors_url":"https://api.github.com/repos/febryhadinata/ruby-controls/contributors","subscribers_url":"https://api.github.com/repos/febryhadinata/ruby-controls/subscribers","subscription_url":"https://api.github.com/repos/febryhadinata/ruby-controls/subscription","commits_url":"https://api.github.com/repos/febryhadinata/ruby-controls/commits{/sha}","git_commits_url":"https://api.github.com/repos/febryhadinata/ruby-controls/git/commits{/sha}","comments_url":"https://api.github.com/repos/febryhadinata/ruby-controls/comments{/number}","issue_comment_url":"https://api.github.com/repos/febryhadinata/ruby-controls/issues/comments{/number}","contents_url":"https://api.github.com/repos/febryhadinata/ruby-controls/contents/{+path}","compare_url":"https://api.github.com/repos/febryhadinata/ruby-controls/compare/{base}...{head}","merges_url":"https://api.github.com/repos/febryhadinata/ruby-controls/merges","archive_url":"https://api.github.com/repos/febryhadinata/ruby-controls/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/febryhadinata/ruby-controls/downloads","issues_url":"https://api.github.com/repos/febryhadinata/ruby-controls/issues{/number}","pulls_url":"https://api.github.com/repos/febryhadinata/ruby-controls/pulls{/number}","milestones_url":"https://api.github.com/repos/febryhadinata/ruby-controls/milestones{/number}","notifications_url":"https://api.github.com/repos/febryhadinata/ruby-controls/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/febryhadinata/ruby-controls/labels{/name}","releases_url":"https://api.github.com/repos/febryhadinata/ruby-controls/releases{/id}","deployments_url":"https://api.github.com/repos/febryhadinata/ruby-controls/deployments","created_at":"2016-01-18T12:51:28Z","updated_at":"2016-01-18T13:03:59Z","pushed_at":"2016-01-22T13:55:21Z","git_url":"git://github.com/febryhadinata/ruby-controls.git","ssh_url":"git@github.com:febryhadinata/ruby-controls.git","clone_url":"https://github.com/febryhadinata/ruby-controls.git","svn_url":"https://github.com/febryhadinata/ruby-controls","homepage":null,"size":561,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"febryhadinata:master","ref":"master","sha":"27b75f69969208bcc8f6a2d2b63641a9e90409da","user":{"login":"febryhadinata","id":3851380,"avatar_url":"https://avatars.githubusercontent.com/u/3851380?v=3","gravatar_id":"","url":"https://api.github.com/users/febryhadinata","html_url":"https://github.com/febryhadinata","followers_url":"https://api.github.com/users/febryhadinata/followers","following_url":"https://api.github.com/users/febryhadinata/following{/other_user}","gists_url":"https://api.github.com/users/febryhadinata/gists{/gist_id}","starred_url":"https://api.github.com/users/febryhadinata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/febryhadinata/subscriptions","organizations_url":"https://api.github.com/users/febryhadinata/orgs","repos_url":"https://api.github.com/users/febryhadinata/repos","events_url":"https://api.github.com/users/febryhadinata/events{/privacy}","received_events_url":"https://api.github.com/users/febryhadinata/received_events","type":"User","site_admin":false},"repo":{"id":49876596,"name":"ruby-controls","full_name":"febryhadinata/ruby-controls","owner":{"login":"febryhadinata","id":3851380,"avatar_url":"https://avatars.githubusercontent.com/u/3851380?v=3","gravatar_id":"","url":"https://api.github.com/users/febryhadinata","html_url":"https://github.com/febryhadinata","followers_url":"https://api.github.com/users/febryhadinata/followers","following_url":"https://api.github.com/users/febryhadinata/following{/other_user}","gists_url":"https://api.github.com/users/febryhadinata/gists{/gist_id}","starred_url":"https://api.github.com/users/febryhadinata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/febryhadinata/subscriptions","organizations_url":"https://api.github.com/users/febryhadinata/orgs","repos_url":"https://api.github.com/users/febryhadinata/repos","events_url":"https://api.github.com/users/febryhadinata/events{/privacy}","received_events_url":"https://api.github.com/users/febryhadinata/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/febryhadinata/ruby-controls","description":"","fork":false,"url":"https://api.github.com/repos/febryhadinata/ruby-controls","forks_url":"https://api.github.com/repos/febryhadinata/ruby-controls/forks","keys_url":"https://api.github.com/repos/febryhadinata/ruby-controls/keys{/key_id}","collaborators_url":"https://api.github.com/repos/febryhadinata/ruby-controls/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/febryhadinata/ruby-controls/teams","hooks_url":"https://api.github.com/repos/febryhadinata/ruby-controls/hooks","issue_events_url":"https://api.github.com/repos/febryhadinata/ruby-controls/issues/events{/number}","events_url":"https://api.github.com/repos/febryhadinata/ruby-controls/events","assignees_url":"https://api.github.com/repos/febryhadinata/ruby-controls/assignees{/user}","branches_url":"https://api.github.com/repos/febryhadinata/ruby-controls/branches{/branch}","tags_url":"https://api.github.com/repos/febryhadinata/ruby-controls/tags","blobs_url":"https://api.github.com/repos/febryhadinata/ruby-controls/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/febryhadinata/ruby-controls/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/febryhadinata/ruby-controls/git/refs{/sha}","trees_url":"https://api.github.com/repos/febryhadinata/ruby-controls/git/trees{/sha}","statuses_url":"https://api.github.com/repos/febryhadinata/ruby-controls/statuses/{sha}","languages_url":"https://api.github.com/repos/febryhadinata/ruby-controls/languages","stargazers_url":"https://api.github.com/repos/febryhadinata/ruby-controls/stargazers","contributors_url":"https://api.github.com/repos/febryhadinata/ruby-controls/contributors","subscribers_url":"https://api.github.com/repos/febryhadinata/ruby-controls/subscribers","subscription_url":"https://api.github.com/repos/febryhadinata/ruby-controls/subscription","commits_url":"https://api.github.com/repos/febryhadinata/ruby-controls/commits{/sha}","git_commits_url":"https://api.github.com/repos/febryhadinata/ruby-controls/git/commits{/sha}","comments_url":"https://api.github.com/repos/febryhadinata/ruby-controls/comments{/number}","issue_comment_url":"https://api.github.com/repos/febryhadinata/ruby-controls/issues/comments{/number}","contents_url":"https://api.github.com/repos/febryhadinata/ruby-controls/contents/{+path}","compare_url":"https://api.github.com/repos/febryhadinata/ruby-controls/compare/{base}...{head}","merges_url":"https://api.github.com/repos/febryhadinata/ruby-controls/merges","archive_url":"https://api.github.com/repos/febryhadinata/ruby-controls/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/febryhadinata/ruby-controls/downloads","issues_url":"https://api.github.com/repos/febryhadinata/ruby-controls/issues{/number}","pulls_url":"https://api.github.com/repos/febryhadinata/ruby-controls/pulls{/number}","milestones_url":"https://api.github.com/repos/febryhadinata/ruby-controls/milestones{/number}","notifications_url":"https://api.github.com/repos/febryhadinata/ruby-controls/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/febryhadinata/ruby-controls/labels{/name}","releases_url":"https://api.github.com/repos/febryhadinata/ruby-controls/releases{/id}","deployments_url":"https://api.github.com/repos/febryhadinata/ruby-controls/deployments","created_at":"2016-01-18T12:51:28Z","updated_at":"2016-01-18T13:03:59Z","pushed_at":"2016-01-22T13:55:21Z","git_url":"git://github.com/febryhadinata/ruby-controls.git","ssh_url":"git@github.com:febryhadinata/ruby-controls.git","clone_url":"https://github.com/febryhadinata/ruby-controls.git","svn_url":"https://github.com/febryhadinata/ruby-controls","homepage":null,"size":561,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/febryhadinata/ruby-controls/pulls/3"},"html":{"href":"https://github.com/febryhadinata/ruby-controls/pull/3"},"issue":{"href":"https://api.github.com/repos/febryhadinata/ruby-controls/issues/3"},"comments":{"href":"https://api.github.com/repos/febryhadinata/ruby-controls/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/febryhadinata/ruby-controls/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/febryhadinata/ruby-controls/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/febryhadinata/ruby-controls/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/febryhadinata/ruby-controls/statuses/510f1121cca62223267627a452d11882424305ab"}}}}