{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/fels_61/pulls/comments/34980444","id":34980444,"diff_hunk":"@@ -0,0 +1,34 @@\n+class Admin::CategoriesController < ApplicationController\n+  before_action :init_category, only: [:show, :edit, :update, :destroy]\n+\n+  def index\n+    @categories = Category.ordered_by_create_at.paginate page: params[:page], per_page: Settings.per_page\n+    @category = Category.new\n+  end\n+\n+  def create\n+    @category = Category.new category_params\n+    if @category.save\n+      flash[:success] = t \"create_category_success_message\"\n+    else\n+      flash[:success] = t \"create_category_failed_message\"\n+    end\n+    redirect_to admin_categories_path\n+  end\n+  \n+  def destroy\n+    @category.destroy\n+    flash[:success] = t \"destroy_category_success_message\"\n+    redirect_to admin_categories_path\n+  end\n+\n+  private\n+  def init_category\n+    @category = Category.find params[:id]\n+  end\n+\n+  def category_params\n+    params.require(:category).permit :name, :description\n+  end\n+end\n+","path":"app/controllers/admin/categories_controller.rb","position":34,"original_position":34,"commit_id":"defe0779a203fb29603520495623e61c4d1b24cd","original_commit_id":"defe0779a203fb29603520495623e61c4d1b24cd","user":{"login":"ThuBM","id":5279620,"avatar_url":"https://avatars.githubusercontent.com/u/5279620?v=3","gravatar_id":"","url":"https://api.github.com/users/ThuBM","html_url":"https://github.com/ThuBM","followers_url":"https://api.github.com/users/ThuBM/followers","following_url":"https://api.github.com/users/ThuBM/following{/other_user}","gists_url":"https://api.github.com/users/ThuBM/gists{/gist_id}","starred_url":"https://api.github.com/users/ThuBM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThuBM/subscriptions","organizations_url":"https://api.github.com/users/ThuBM/orgs","repos_url":"https://api.github.com/users/ThuBM/repos","events_url":"https://api.github.com/users/ThuBM/events{/privacy}","received_events_url":"https://api.github.com/users/ThuBM/received_events","type":"User","site_admin":false},"body":"remove this line","created_at":"2015-07-20T09:47:37Z","updated_at":"2015-07-20T09:47:37Z","html_url":"https://github.com/framgia/fels_61/pull/10#discussion_r34980444","pull_request_url":"https://api.github.com/repos/framgia/fels_61/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/framgia/fels_61/pulls/comments/34980444"},"html":{"href":"https://github.com/framgia/fels_61/pull/10#discussion_r34980444"},"pull_request":{"href":"https://api.github.com/repos/framgia/fels_61/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/fels_61/pulls/10","id":40335127,"html_url":"https://github.com/framgia/fels_61/pull/10","diff_url":"https://github.com/framgia/fels_61/pull/10.diff","patch_url":"https://github.com/framgia/fels_61/pull/10.patch","issue_url":"https://api.github.com/repos/framgia/fels_61/issues/10","number":10,"state":"open","locked":false,"title":"create and destroy category","user":{"login":"haonh","id":12791465,"avatar_url":"https://avatars.githubusercontent.com/u/12791465?v=3","gravatar_id":"","url":"https://api.github.com/users/haonh","html_url":"https://github.com/haonh","followers_url":"https://api.github.com/users/haonh/followers","following_url":"https://api.github.com/users/haonh/following{/other_user}","gists_url":"https://api.github.com/users/haonh/gists{/gist_id}","starred_url":"https://api.github.com/users/haonh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haonh/subscriptions","organizations_url":"https://api.github.com/users/haonh/orgs","repos_url":"https://api.github.com/users/haonh/repos","events_url":"https://api.github.com/users/haonh/events{/privacy}","received_events_url":"https://api.github.com/users/haonh/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-07-20T09:30:27Z","updated_at":"2015-07-20T09:47:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"408b72a55b785caa339a7b4ba489243bfd0e7849","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/framgia/fels_61/pulls/10/commits","review_comments_url":"https://api.github.com/repos/framgia/fels_61/pulls/10/comments","review_comment_url":"https://api.github.com/repos/framgia/fels_61/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/fels_61/issues/10/comments","statuses_url":"https://api.github.com/repos/framgia/fels_61/statuses/defe0779a203fb29603520495623e61c4d1b24cd","head":{"label":"haonh:admin","ref":"admin","sha":"defe0779a203fb29603520495623e61c4d1b24cd","user":{"login":"haonh","id":12791465,"avatar_url":"https://avatars.githubusercontent.com/u/12791465?v=3","gravatar_id":"","url":"https://api.github.com/users/haonh","html_url":"https://github.com/haonh","followers_url":"https://api.github.com/users/haonh/followers","following_url":"https://api.github.com/users/haonh/following{/other_user}","gists_url":"https://api.github.com/users/haonh/gists{/gist_id}","starred_url":"https://api.github.com/users/haonh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haonh/subscriptions","organizations_url":"https://api.github.com/users/haonh/orgs","repos_url":"https://api.github.com/users/haonh/repos","events_url":"https://api.github.com/users/haonh/events{/privacy}","received_events_url":"https://api.github.com/users/haonh/received_events","type":"User","site_admin":false},"repo":{"id":39062937,"name":"fels_61","full_name":"haonh/fels_61","owner":{"login":"haonh","id":12791465,"avatar_url":"https://avatars.githubusercontent.com/u/12791465?v=3","gravatar_id":"","url":"https://api.github.com/users/haonh","html_url":"https://github.com/haonh","followers_url":"https://api.github.com/users/haonh/followers","following_url":"https://api.github.com/users/haonh/following{/other_user}","gists_url":"https://api.github.com/users/haonh/gists{/gist_id}","starred_url":"https://api.github.com/users/haonh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haonh/subscriptions","organizations_url":"https://api.github.com/users/haonh/orgs","repos_url":"https://api.github.com/users/haonh/repos","events_url":"https://api.github.com/users/haonh/events{/privacy}","received_events_url":"https://api.github.com/users/haonh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/haonh/fels_61","description":"Framgia E-Learning System (training)","fork":true,"url":"https://api.github.com/repos/haonh/fels_61","forks_url":"https://api.github.com/repos/haonh/fels_61/forks","keys_url":"https://api.github.com/repos/haonh/fels_61/keys{/key_id}","collaborators_url":"https://api.github.com/repos/haonh/fels_61/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/haonh/fels_61/teams","hooks_url":"https://api.github.com/repos/haonh/fels_61/hooks","issue_events_url":"https://api.github.com/repos/haonh/fels_61/issues/events{/number}","events_url":"https://api.github.com/repos/haonh/fels_61/events","assignees_url":"https://api.github.com/repos/haonh/fels_61/assignees{/user}","branches_url":"https://api.github.com/repos/haonh/fels_61/branches{/branch}","tags_url":"https://api.github.com/repos/haonh/fels_61/tags","blobs_url":"https://api.github.com/repos/haonh/fels_61/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/haonh/fels_61/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/haonh/fels_61/git/refs{/sha}","trees_url":"https://api.github.com/repos/haonh/fels_61/git/trees{/sha}","statuses_url":"https://api.github.com/repos/haonh/fels_61/statuses/{sha}","languages_url":"https://api.github.com/repos/haonh/fels_61/languages","stargazers_url":"https://api.github.com/repos/haonh/fels_61/stargazers","contributors_url":"https://api.github.com/repos/haonh/fels_61/contributors","subscribers_url":"https://api.github.com/repos/haonh/fels_61/subscribers","subscription_url":"https://api.github.com/repos/haonh/fels_61/subscription","commits_url":"https://api.github.com/repos/haonh/fels_61/commits{/sha}","git_commits_url":"https://api.github.com/repos/haonh/fels_61/git/commits{/sha}","comments_url":"https://api.github.com/repos/haonh/fels_61/comments{/number}","issue_comment_url":"https://api.github.com/repos/haonh/fels_61/issues/comments{/number}","contents_url":"https://api.github.com/repos/haonh/fels_61/contents/{+path}","compare_url":"https://api.github.com/repos/haonh/fels_61/compare/{base}...{head}","merges_url":"https://api.github.com/repos/haonh/fels_61/merges","archive_url":"https://api.github.com/repos/haonh/fels_61/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/haonh/fels_61/downloads","issues_url":"https://api.github.com/repos/haonh/fels_61/issues{/number}","pulls_url":"https://api.github.com/repos/haonh/fels_61/pulls{/number}","milestones_url":"https://api.github.com/repos/haonh/fels_61/milestones{/number}","notifications_url":"https://api.github.com/repos/haonh/fels_61/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/haonh/fels_61/labels{/name}","releases_url":"https://api.github.com/repos/haonh/fels_61/releases{/id}","created_at":"2015-07-14T08:21:34Z","updated_at":"2015-06-16T07:42:54Z","pushed_at":"2015-07-20T09:38:12Z","git_url":"git://github.com/haonh/fels_61.git","ssh_url":"git@github.com:haonh/fels_61.git","clone_url":"https://github.com/haonh/fels_61.git","svn_url":"https://github.com/haonh/fels_61","homepage":null,"size":148,"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":"master"}},"base":{"label":"framgia:develop","ref":"develop","sha":"7839523d3647bf41a44344af00facb62636ed468","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":37515721,"name":"fels_61","full_name":"framgia/fels_61","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/fels_61","description":"Framgia E-Learning System (training)","fork":false,"url":"https://api.github.com/repos/framgia/fels_61","forks_url":"https://api.github.com/repos/framgia/fels_61/forks","keys_url":"https://api.github.com/repos/framgia/fels_61/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/fels_61/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/fels_61/teams","hooks_url":"https://api.github.com/repos/framgia/fels_61/hooks","issue_events_url":"https://api.github.com/repos/framgia/fels_61/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/fels_61/events","assignees_url":"https://api.github.com/repos/framgia/fels_61/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/fels_61/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/fels_61/tags","blobs_url":"https://api.github.com/repos/framgia/fels_61/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/fels_61/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/fels_61/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/fels_61/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/fels_61/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/fels_61/languages","stargazers_url":"https://api.github.com/repos/framgia/fels_61/stargazers","contributors_url":"https://api.github.com/repos/framgia/fels_61/contributors","subscribers_url":"https://api.github.com/repos/framgia/fels_61/subscribers","subscription_url":"https://api.github.com/repos/framgia/fels_61/subscription","commits_url":"https://api.github.com/repos/framgia/fels_61/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/fels_61/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/fels_61/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/fels_61/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/fels_61/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/fels_61/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/fels_61/merges","archive_url":"https://api.github.com/repos/framgia/fels_61/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/fels_61/downloads","issues_url":"https://api.github.com/repos/framgia/fels_61/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/fels_61/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/fels_61/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/fels_61/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/fels_61/labels{/name}","releases_url":"https://api.github.com/repos/framgia/fels_61/releases{/id}","created_at":"2015-06-16T07:42:54Z","updated_at":"2015-06-16T07:42:54Z","pushed_at":"2015-07-20T09:38:13Z","git_url":"git://github.com/framgia/fels_61.git","ssh_url":"git@github.com:framgia/fels_61.git","clone_url":"https://github.com/framgia/fels_61.git","svn_url":"https://github.com/framgia/fels_61","homepage":null,"size":410,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/fels_61/pulls/10"},"html":{"href":"https://github.com/framgia/fels_61/pull/10"},"issue":{"href":"https://api.github.com/repos/framgia/fels_61/issues/10"},"comments":{"href":"https://api.github.com/repos/framgia/fels_61/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/fels_61/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/fels_61/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/fels_61/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/fels_61/statuses/defe0779a203fb29603520495623e61c4d1b24cd"}}}}