You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: application_controller.rb
    path of file: ./repos/qaror/app/controllers
    
    the code of the file until where you have to start completion: class ApplicationController < ActionController::Base

  rescue_from ActiveRecord::RecordNotFound, :with => :response_404
  rescue_from CanCan::AccessDenied do |e|
    auth_failed(e.message.to_s + t(:unaut
    
  def auth_failed(notice=nil)
    notice = notice.split(' base ').last if notice.include? 'base'
    notice = notice.nil? ? t(:unauthorized_http) : notice
    respond_to do |format|
        format.html {
           flash[:notice] = notice
           redirect_to request.referer ? request.referer : root_url
        }
        format.js {
           render_flash_window :content=> notice
        }
    end
  end