{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/brs_8/pulls/comments/28305576","id":28305576,"diff_hunk":"@@ -0,0 +1,41 @@\n+class BookRequestsController < InheritedResources::Base\n+  \n+  before_action :user_signed_in?, only: [:create, :destroy, :index]\n+  \n+  def create\n+    @book_request = current_user.book_requests.build book_request_params\n+    if @book_request.save\n+      flash[:success] = \"Book request created!\"\n+      redirect_to book_requests_path\n+    else\n+      @book_requests = current_user.book_requests\n+      render :index\n+    end\n+  end\n+  \n+  def index\n+    if user_signed_in?\n+      @book_requests = current_user.book_requests\n+      @book_request = current_user.book_requests.build\n+    else\n+      redirect_to root_url\n+    end\n+  end\n+\n+  def destroy\n+\n+    book_request = BookRequest.find(params[:id]).destroy\n+    if book_request.destroyed?  \n+      flash[:success] = \"Book request deleted!\"\n+    else\n+      flash[:danger] = \"Could not delete!\"\n+    end\n+    redirect_to book_requests_path\n+  end\n+\n+  private\n+\n+    def book_request_params","path":"app/controllers/book_requests_controller.rb","position":38,"original_position":38,"commit_id":"e91b1d405a67ffdbe048bd6d8cf898d466baee1b","original_commit_id":"e91b1d405a67ffdbe048bd6d8cf898d466baee1b","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":"indent","created_at":"2015-04-14T07:31:09Z","updated_at":"2015-04-14T07:31:09Z","html_url":"https://github.com/framgia/brs_8/pull/11#discussion_r28305576","pull_request_url":"https://api.github.com/repos/framgia/brs_8/pulls/11","_links":{"self":{"href":"https://api.github.com/repos/framgia/brs_8/pulls/comments/28305576"},"html":{"href":"https://github.com/framgia/brs_8/pull/11#discussion_r28305576"},"pull_request":{"href":"https://api.github.com/repos/framgia/brs_8/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/brs_8/pulls/11","id":33028102,"html_url":"https://github.com/framgia/brs_8/pull/11","diff_url":"https://github.com/framgia/brs_8/pull/11.diff","patch_url":"https://github.com/framgia/brs_8/pull/11.patch","issue_url":"https://api.github.com/repos/framgia/brs_8/issues/11","number":11,"state":"open","locked":false,"title":"user can make/cancel book request","user":{"login":"nguyenngodinh","id":9555335,"avatar_url":"https://avatars.githubusercontent.com/u/9555335?v=3","gravatar_id":"","url":"https://api.github.com/users/nguyenngodinh","html_url":"https://github.com/nguyenngodinh","followers_url":"https://api.github.com/users/nguyenngodinh/followers","following_url":"https://api.github.com/users/nguyenngodinh/following{/other_user}","gists_url":"https://api.github.com/users/nguyenngodinh/gists{/gist_id}","starred_url":"https://api.github.com/users/nguyenngodinh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nguyenngodinh/subscriptions","organizations_url":"https://api.github.com/users/nguyenngodinh/orgs","repos_url":"https://api.github.com/users/nguyenngodinh/repos","events_url":"https://api.github.com/users/nguyenngodinh/events{/privacy}","received_events_url":"https://api.github.com/users/nguyenngodinh/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-04-10T08:45:43Z","updated_at":"2015-04-14T07:31:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2f84ecc0fc5ca70fd65e8d70bf8cb7dbb6387560","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/framgia/brs_8/pulls/11/commits","review_comments_url":"https://api.github.com/repos/framgia/brs_8/pulls/11/comments","review_comment_url":"https://api.github.com/repos/framgia/brs_8/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/brs_8/issues/11/comments","statuses_url":"https://api.github.com/repos/framgia/brs_8/statuses/e91b1d405a67ffdbe048bd6d8cf898d466baee1b","head":{"label":"nguyenngodinh:user-make-book-request","ref":"user-make-book-request","sha":"e91b1d405a67ffdbe048bd6d8cf898d466baee1b","user":{"login":"nguyenngodinh","id":9555335,"avatar_url":"https://avatars.githubusercontent.com/u/9555335?v=3","gravatar_id":"","url":"https://api.github.com/users/nguyenngodinh","html_url":"https://github.com/nguyenngodinh","followers_url":"https://api.github.com/users/nguyenngodinh/followers","following_url":"https://api.github.com/users/nguyenngodinh/following{/other_user}","gists_url":"https://api.github.com/users/nguyenngodinh/gists{/gist_id}","starred_url":"https://api.github.com/users/nguyenngodinh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nguyenngodinh/subscriptions","organizations_url":"https://api.github.com/users/nguyenngodinh/orgs","repos_url":"https://api.github.com/users/nguyenngodinh/repos","events_url":"https://api.github.com/users/nguyenngodinh/events{/privacy}","received_events_url":"https://api.github.com/users/nguyenngodinh/received_events","type":"User","site_admin":false},"repo":{"id":32849277,"name":"brs_8","full_name":"nguyenngodinh/brs_8","owner":{"login":"nguyenngodinh","id":9555335,"avatar_url":"https://avatars.githubusercontent.com/u/9555335?v=3","gravatar_id":"","url":"https://api.github.com/users/nguyenngodinh","html_url":"https://github.com/nguyenngodinh","followers_url":"https://api.github.com/users/nguyenngodinh/followers","following_url":"https://api.github.com/users/nguyenngodinh/following{/other_user}","gists_url":"https://api.github.com/users/nguyenngodinh/gists{/gist_id}","starred_url":"https://api.github.com/users/nguyenngodinh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nguyenngodinh/subscriptions","organizations_url":"https://api.github.com/users/nguyenngodinh/orgs","repos_url":"https://api.github.com/users/nguyenngodinh/repos","events_url":"https://api.github.com/users/nguyenngodinh/events{/privacy}","received_events_url":"https://api.github.com/users/nguyenngodinh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nguyenngodinh/brs_8","description":"Book Reviewing System (training)","fork":true,"url":"https://api.github.com/repos/nguyenngodinh/brs_8","forks_url":"https://api.github.com/repos/nguyenngodinh/brs_8/forks","keys_url":"https://api.github.com/repos/nguyenngodinh/brs_8/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nguyenngodinh/brs_8/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nguyenngodinh/brs_8/teams","hooks_url":"https://api.github.com/repos/nguyenngodinh/brs_8/hooks","issue_events_url":"https://api.github.com/repos/nguyenngodinh/brs_8/issues/events{/number}","events_url":"https://api.github.com/repos/nguyenngodinh/brs_8/events","assignees_url":"https://api.github.com/repos/nguyenngodinh/brs_8/assignees{/user}","branches_url":"https://api.github.com/repos/nguyenngodinh/brs_8/branches{/branch}","tags_url":"https://api.github.com/repos/nguyenngodinh/brs_8/tags","blobs_url":"https://api.github.com/repos/nguyenngodinh/brs_8/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nguyenngodinh/brs_8/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nguyenngodinh/brs_8/git/refs{/sha}","trees_url":"https://api.github.com/repos/nguyenngodinh/brs_8/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nguyenngodinh/brs_8/statuses/{sha}","languages_url":"https://api.github.com/repos/nguyenngodinh/brs_8/languages","stargazers_url":"https://api.github.com/repos/nguyenngodinh/brs_8/stargazers","contributors_url":"https://api.github.com/repos/nguyenngodinh/brs_8/contributors","subscribers_url":"https://api.github.com/repos/nguyenngodinh/brs_8/subscribers","subscription_url":"https://api.github.com/repos/nguyenngodinh/brs_8/subscription","commits_url":"https://api.github.com/repos/nguyenngodinh/brs_8/commits{/sha}","git_commits_url":"https://api.github.com/repos/nguyenngodinh/brs_8/git/commits{/sha}","comments_url":"https://api.github.com/repos/nguyenngodinh/brs_8/comments{/number}","issue_comment_url":"https://api.github.com/repos/nguyenngodinh/brs_8/issues/comments{/number}","contents_url":"https://api.github.com/repos/nguyenngodinh/brs_8/contents/{+path}","compare_url":"https://api.github.com/repos/nguyenngodinh/brs_8/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nguyenngodinh/brs_8/merges","archive_url":"https://api.github.com/repos/nguyenngodinh/brs_8/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nguyenngodinh/brs_8/downloads","issues_url":"https://api.github.com/repos/nguyenngodinh/brs_8/issues{/number}","pulls_url":"https://api.github.com/repos/nguyenngodinh/brs_8/pulls{/number}","milestones_url":"https://api.github.com/repos/nguyenngodinh/brs_8/milestones{/number}","notifications_url":"https://api.github.com/repos/nguyenngodinh/brs_8/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nguyenngodinh/brs_8/labels{/name}","releases_url":"https://api.github.com/repos/nguyenngodinh/brs_8/releases{/id}","created_at":"2015-03-25T07:28:15Z","updated_at":"2015-04-01T12:37:46Z","pushed_at":"2015-04-14T07:28:49Z","git_url":"git://github.com/nguyenngodinh/brs_8.git","ssh_url":"git@github.com:nguyenngodinh/brs_8.git","clone_url":"https://github.com/nguyenngodinh/brs_8.git","svn_url":"https://github.com/nguyenngodinh/brs_8","homepage":null,"size":5396,"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":"17940088f0d70d58b055e95b1ea75649aa03fcf1","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":32147504,"name":"brs_8","full_name":"framgia/brs_8","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/brs_8","description":"Book Reviewing System (training)","fork":false,"url":"https://api.github.com/repos/framgia/brs_8","forks_url":"https://api.github.com/repos/framgia/brs_8/forks","keys_url":"https://api.github.com/repos/framgia/brs_8/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/brs_8/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/brs_8/teams","hooks_url":"https://api.github.com/repos/framgia/brs_8/hooks","issue_events_url":"https://api.github.com/repos/framgia/brs_8/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/brs_8/events","assignees_url":"https://api.github.com/repos/framgia/brs_8/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/brs_8/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/brs_8/tags","blobs_url":"https://api.github.com/repos/framgia/brs_8/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/brs_8/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/brs_8/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/brs_8/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/brs_8/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/brs_8/languages","stargazers_url":"https://api.github.com/repos/framgia/brs_8/stargazers","contributors_url":"https://api.github.com/repos/framgia/brs_8/contributors","subscribers_url":"https://api.github.com/repos/framgia/brs_8/subscribers","subscription_url":"https://api.github.com/repos/framgia/brs_8/subscription","commits_url":"https://api.github.com/repos/framgia/brs_8/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/brs_8/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/brs_8/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/brs_8/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/brs_8/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/brs_8/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/brs_8/merges","archive_url":"https://api.github.com/repos/framgia/brs_8/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/brs_8/downloads","issues_url":"https://api.github.com/repos/framgia/brs_8/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/brs_8/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/brs_8/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/brs_8/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/brs_8/labels{/name}","releases_url":"https://api.github.com/repos/framgia/brs_8/releases{/id}","created_at":"2015-03-13T09:34:53Z","updated_at":"2015-03-13T09:34:53Z","pushed_at":"2015-04-14T07:28:49Z","git_url":"git://github.com/framgia/brs_8.git","ssh_url":"git@github.com:framgia/brs_8.git","clone_url":"https://github.com/framgia/brs_8.git","svn_url":"https://github.com/framgia/brs_8","homepage":null,"size":5660,"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":1,"forks":3,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/brs_8/pulls/11"},"html":{"href":"https://github.com/framgia/brs_8/pull/11"},"issue":{"href":"https://api.github.com/repos/framgia/brs_8/issues/11"},"comments":{"href":"https://api.github.com/repos/framgia/brs_8/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/brs_8/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/brs_8/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/brs_8/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/brs_8/statuses/e91b1d405a67ffdbe048bd6d8cf898d466baee1b"}}}}