GitHub PullRequestReviewCommentEvent at 2014-03-31 18:42:03
Repository: neighborly
Actor: Irio
Payload: {"comment":{"url":"https://api.github.com/repos/neighborly/neighborly/pulls/comments/11130165","id":11130165,"diff_hunk":"@@ -7,17 +7,23 @@ module ExceptionHandler\n       rescue_from ActionController::UnknownController, with: :render_404\n       rescue_from ActiveRecord::RecordNotFound, with: :render_404\n \n-      rescue_from CanCan::Unauthorized do |exception|\n-        session[:return_to] = request.env['REQUEST_URI']\n-        message = exception.message\n+      rescue_from Pundit::NotAuthorizedError, with: :auth_error\n+      rescue_from CanCan::Unauthorized, with: :auth_error\n+    end\n+\n+    def auth_error(exception)\n+      session[:return_to] = request.env['REQUEST_URI']\n+\n+      # Clear the previous response body to avoid a DoubleRenderError\n+      # when redirecting or rendering another view\n+      self.response_body = nil\n \n-        if current_user.nil?\n-          redirect_to new_user_session_path, flash: { devise_error: I18n.t('devise.failure.unauthenticated') }\n-        elsif request.env[\"HTTP_REFERER\"]\n-          redirect_to :back, alert: message\n-        else\n-          redirect_to root_path, alert: message\n-        end\n+      if current_user.nil?\n+        redirect_to new_user_session_path, alert: I18n.t('devise.failure.unauthenticated')\n+      elsif request.env[\"HTTP_REFERER\"]","path":"app/controllers/concerns/exception_handler.rb","position":27,"original_position":27,"commit_id":"93386ca5bb03f13db0e79335e362a31bda139642","original_commit_id":"93386ca5bb03f13db0e79335e362a31bda139642","user":{"login":"Irio","id":667753,"avatar_url":"https://avatars.githubusercontent.com/u/667753?","gravatar_id":"8c01de31d4ea71756e85a0aca3852e2e","url":"https://api.github.com/users/Irio","html_url":"https://github.com/Irio","followers_url":"https://api.github.com/users/Irio/followers","following_url":"https://api.github.com/users/Irio/following{/other_user}","gists_url":"https://api.github.com/users/Irio/gists{/gist_id}","starred_url":"https://api.github.com/users/Irio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Irio/subscriptions","organizations_url":"https://api.github.com/users/Irio/orgs","repos_url":"https://api.github.com/users/Irio/repos","events_url":"https://api.github.com/users/Irio/events{/privacy}","received_events_url":"https://api.github.com/users/Irio/received_events","type":"User","site_admin":false},"body":"You asked me to use single quotes on specs, so here should be used too.\r\n\r\n:nail_care: ","created_at":"2014-03-31T18:42:03Z","updated_at":"2014-03-31T18:42:03Z","html_url":"https://github.com/neighborly/neighborly/pull/141#discussion_r11130165","pull_request_url":"https://api.github.com/repos/neighborly/neighborly/pulls/141","_links":{"self":{"href":"https://api.github.com/repos/neighborly/neighborly/pulls/comments/11130165"},"html":{"href":"https://github.com/neighborly/neighborly/pull/141#discussion_r11130165"},"pull_request":{"href":"https://api.github.com/repos/neighborly/neighborly/pulls/141"}}}}