{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/fts_26/pulls/comments/30383368","id":30383368,"diff_hunk":"@@ -0,0 +1,58 @@\n+class Admin::QuestionsController < ApplicationController\n+  before_action :authenticate_user!, :require_admin\n+\n+  def index\n+    @categories = Category.all\n+    @questions = Question.filter_category(params[:category_id])\n+      .paginate page: params[:page], per_page: Settings.per_page\n+  end\n+\n+  def new\n+    @category = Category.find params[:category_id]\n+    @question = Question.new\n+    Settings.num_of_answer.times{@question.answers.build}\n+  end\n+\n+  def create\n+    @category = Category.find params[:category_id]\n+    @question = @category.questions.build question_params\n+    if @question.save\n+      flash[:success] = I18n.t 'notice.question_success'\n+      redirect_to admin_questions_path\n+    else\n+      @categories = Category.all\n+      render \"new\"\n+    end\n+  end\n+\n+  def edit\n+    @categories = Category.all\n+    @question = Question.find params[:id]\n+    @answers = @question.answers","path":"app/controllers/admin/questions_controller.rb","position":31,"original_position":31,"commit_id":"b344b54470858f0fbeba0f7e037392c410d4e827","original_commit_id":"35ea1ee26d3fab1f303a6e6754fdc70a19294118","user":{"login":"PhamVanTung","id":11971984,"avatar_url":"https://avatars.githubusercontent.com/u/11971984?v=3","gravatar_id":"","url":"https://api.github.com/users/PhamVanTung","html_url":"https://github.com/PhamVanTung","followers_url":"https://api.github.com/users/PhamVanTung/followers","following_url":"https://api.github.com/users/PhamVanTung/following{/other_user}","gists_url":"https://api.github.com/users/PhamVanTung/gists{/gist_id}","starred_url":"https://api.github.com/users/PhamVanTung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PhamVanTung/subscriptions","organizations_url":"https://api.github.com/users/PhamVanTung/orgs","repos_url":"https://api.github.com/users/PhamVanTung/repos","events_url":"https://api.github.com/users/PhamVanTung/events{/privacy}","received_events_url":"https://api.github.com/users/PhamVanTung/received_events","type":"User","site_admin":false},"body":"Có dùng @categories, @answers ","created_at":"2015-05-15T03:46:58Z","updated_at":"2015-05-15T03:46:58Z","html_url":"https://github.com/framgia/fts_26/pull/13#discussion_r30383368","pull_request_url":"https://api.github.com/repos/framgia/fts_26/pulls/13","_links":{"self":{"href":"https://api.github.com/repos/framgia/fts_26/pulls/comments/30383368"},"html":{"href":"https://github.com/framgia/fts_26/pull/13#discussion_r30383368"},"pull_request":{"href":"https://api.github.com/repos/framgia/fts_26/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/fts_26/pulls/13","id":35404526,"html_url":"https://github.com/framgia/fts_26/pull/13","diff_url":"https://github.com/framgia/fts_26/pull/13.diff","patch_url":"https://github.com/framgia/fts_26/pull/13.patch","issue_url":"https://api.github.com/repos/framgia/fts_26/issues/13","number":13,"state":"open","locked":false,"title":"create question && anwser","user":{"login":"PhamVanTung","id":11971984,"avatar_url":"https://avatars.githubusercontent.com/u/11971984?v=3","gravatar_id":"","url":"https://api.github.com/users/PhamVanTung","html_url":"https://github.com/PhamVanTung","followers_url":"https://api.github.com/users/PhamVanTung/followers","following_url":"https://api.github.com/users/PhamVanTung/following{/other_user}","gists_url":"https://api.github.com/users/PhamVanTung/gists{/gist_id}","starred_url":"https://api.github.com/users/PhamVanTung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PhamVanTung/subscriptions","organizations_url":"https://api.github.com/users/PhamVanTung/orgs","repos_url":"https://api.github.com/users/PhamVanTung/repos","events_url":"https://api.github.com/users/PhamVanTung/events{/privacy}","received_events_url":"https://api.github.com/users/PhamVanTung/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-05-14T08:55:19Z","updated_at":"2015-05-15T03:46:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"810581aa2a20891986ef8a58fa30015e61d4e516","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/framgia/fts_26/pulls/13/commits","review_comments_url":"https://api.github.com/repos/framgia/fts_26/pulls/13/comments","review_comment_url":"https://api.github.com/repos/framgia/fts_26/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/fts_26/issues/13/comments","statuses_url":"https://api.github.com/repos/framgia/fts_26/statuses/b344b54470858f0fbeba0f7e037392c410d4e827","head":{"label":"PhamVanTung:question","ref":"question","sha":"b344b54470858f0fbeba0f7e037392c410d4e827","user":{"login":"PhamVanTung","id":11971984,"avatar_url":"https://avatars.githubusercontent.com/u/11971984?v=3","gravatar_id":"","url":"https://api.github.com/users/PhamVanTung","html_url":"https://github.com/PhamVanTung","followers_url":"https://api.github.com/users/PhamVanTung/followers","following_url":"https://api.github.com/users/PhamVanTung/following{/other_user}","gists_url":"https://api.github.com/users/PhamVanTung/gists{/gist_id}","starred_url":"https://api.github.com/users/PhamVanTung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PhamVanTung/subscriptions","organizations_url":"https://api.github.com/users/PhamVanTung/orgs","repos_url":"https://api.github.com/users/PhamVanTung/repos","events_url":"https://api.github.com/users/PhamVanTung/events{/privacy}","received_events_url":"https://api.github.com/users/PhamVanTung/received_events","type":"User","site_admin":false},"repo":{"id":35406992,"name":"fts_26","full_name":"PhamVanTung/fts_26","owner":{"login":"PhamVanTung","id":11971984,"avatar_url":"https://avatars.githubusercontent.com/u/11971984?v=3","gravatar_id":"","url":"https://api.github.com/users/PhamVanTung","html_url":"https://github.com/PhamVanTung","followers_url":"https://api.github.com/users/PhamVanTung/followers","following_url":"https://api.github.com/users/PhamVanTung/following{/other_user}","gists_url":"https://api.github.com/users/PhamVanTung/gists{/gist_id}","starred_url":"https://api.github.com/users/PhamVanTung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PhamVanTung/subscriptions","organizations_url":"https://api.github.com/users/PhamVanTung/orgs","repos_url":"https://api.github.com/users/PhamVanTung/repos","events_url":"https://api.github.com/users/PhamVanTung/events{/privacy}","received_events_url":"https://api.github.com/users/PhamVanTung/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/PhamVanTung/fts_26","description":"Framgia Test System (training)","fork":true,"url":"https://api.github.com/repos/PhamVanTung/fts_26","forks_url":"https://api.github.com/repos/PhamVanTung/fts_26/forks","keys_url":"https://api.github.com/repos/PhamVanTung/fts_26/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PhamVanTung/fts_26/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PhamVanTung/fts_26/teams","hooks_url":"https://api.github.com/repos/PhamVanTung/fts_26/hooks","issue_events_url":"https://api.github.com/repos/PhamVanTung/fts_26/issues/events{/number}","events_url":"https://api.github.com/repos/PhamVanTung/fts_26/events","assignees_url":"https://api.github.com/repos/PhamVanTung/fts_26/assignees{/user}","branches_url":"https://api.github.com/repos/PhamVanTung/fts_26/branches{/branch}","tags_url":"https://api.github.com/repos/PhamVanTung/fts_26/tags","blobs_url":"https://api.github.com/repos/PhamVanTung/fts_26/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PhamVanTung/fts_26/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PhamVanTung/fts_26/git/refs{/sha}","trees_url":"https://api.github.com/repos/PhamVanTung/fts_26/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PhamVanTung/fts_26/statuses/{sha}","languages_url":"https://api.github.com/repos/PhamVanTung/fts_26/languages","stargazers_url":"https://api.github.com/repos/PhamVanTung/fts_26/stargazers","contributors_url":"https://api.github.com/repos/PhamVanTung/fts_26/contributors","subscribers_url":"https://api.github.com/repos/PhamVanTung/fts_26/subscribers","subscription_url":"https://api.github.com/repos/PhamVanTung/fts_26/subscription","commits_url":"https://api.github.com/repos/PhamVanTung/fts_26/commits{/sha}","git_commits_url":"https://api.github.com/repos/PhamVanTung/fts_26/git/commits{/sha}","comments_url":"https://api.github.com/repos/PhamVanTung/fts_26/comments{/number}","issue_comment_url":"https://api.github.com/repos/PhamVanTung/fts_26/issues/comments{/number}","contents_url":"https://api.github.com/repos/PhamVanTung/fts_26/contents/{+path}","compare_url":"https://api.github.com/repos/PhamVanTung/fts_26/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PhamVanTung/fts_26/merges","archive_url":"https://api.github.com/repos/PhamVanTung/fts_26/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PhamVanTung/fts_26/downloads","issues_url":"https://api.github.com/repos/PhamVanTung/fts_26/issues{/number}","pulls_url":"https://api.github.com/repos/PhamVanTung/fts_26/pulls{/number}","milestones_url":"https://api.github.com/repos/PhamVanTung/fts_26/milestones{/number}","notifications_url":"https://api.github.com/repos/PhamVanTung/fts_26/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PhamVanTung/fts_26/labels{/name}","releases_url":"https://api.github.com/repos/PhamVanTung/fts_26/releases{/id}","created_at":"2015-05-11T06:45:43Z","updated_at":"2015-05-06T06:49:04Z","pushed_at":"2015-05-15T03:41:44Z","git_url":"git://github.com/PhamVanTung/fts_26.git","ssh_url":"git@github.com:PhamVanTung/fts_26.git","clone_url":"https://github.com/PhamVanTung/fts_26.git","svn_url":"https://github.com/PhamVanTung/fts_26","homepage":null,"size":179,"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":"959f2c6d20c901e958f8494422b0263735e71f1b","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":35143790,"name":"fts_26","full_name":"framgia/fts_26","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/fts_26","description":"Framgia Test System (training)","fork":false,"url":"https://api.github.com/repos/framgia/fts_26","forks_url":"https://api.github.com/repos/framgia/fts_26/forks","keys_url":"https://api.github.com/repos/framgia/fts_26/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/fts_26/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/fts_26/teams","hooks_url":"https://api.github.com/repos/framgia/fts_26/hooks","issue_events_url":"https://api.github.com/repos/framgia/fts_26/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/fts_26/events","assignees_url":"https://api.github.com/repos/framgia/fts_26/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/fts_26/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/fts_26/tags","blobs_url":"https://api.github.com/repos/framgia/fts_26/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/fts_26/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/fts_26/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/fts_26/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/fts_26/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/fts_26/languages","stargazers_url":"https://api.github.com/repos/framgia/fts_26/stargazers","contributors_url":"https://api.github.com/repos/framgia/fts_26/contributors","subscribers_url":"https://api.github.com/repos/framgia/fts_26/subscribers","subscription_url":"https://api.github.com/repos/framgia/fts_26/subscription","commits_url":"https://api.github.com/repos/framgia/fts_26/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/fts_26/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/fts_26/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/fts_26/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/fts_26/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/fts_26/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/fts_26/merges","archive_url":"https://api.github.com/repos/framgia/fts_26/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/fts_26/downloads","issues_url":"https://api.github.com/repos/framgia/fts_26/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/fts_26/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/fts_26/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/fts_26/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/fts_26/labels{/name}","releases_url":"https://api.github.com/repos/framgia/fts_26/releases{/id}","created_at":"2015-05-06T06:49:04Z","updated_at":"2015-05-06T06:49:04Z","pushed_at":"2015-05-15T03:41:44Z","git_url":"git://github.com/framgia/fts_26.git","ssh_url":"git@github.com:framgia/fts_26.git","clone_url":"https://github.com/framgia/fts_26.git","svn_url":"https://github.com/framgia/fts_26","homepage":null,"size":528,"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":1,"forks":2,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/fts_26/pulls/13"},"html":{"href":"https://github.com/framgia/fts_26/pull/13"},"issue":{"href":"https://api.github.com/repos/framgia/fts_26/issues/13"},"comments":{"href":"https://api.github.com/repos/framgia/fts_26/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/fts_26/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/fts_26/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/fts_26/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/fts_26/statuses/b344b54470858f0fbeba0f7e037392c410d4e827"}}}}