Sha256: fc11158b645822f6759128b72f52db4edc47b985f5960291888c99d6d46f9626
Contents?: true
Size: 949 Bytes
Versions: 21
Compression:
Stored size: 949 Bytes
Contents
require 'pundit' require 'exceptions' # class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception # # Pundit implementation # include Pundit rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized # include Exceptions # rescue_from Exception, with: :handle_all_errors # rescue_from Exceptions::WhatAnError do |e| # flash[:error] = e.message # redirect_to root_url # end # # private # def user_not_authorized(exception) # policy_name = exception.policy.class.to_s.underscore # flash[:error] = t '.not_authorized' redirect_to(request.referrer || "/pages/error") end # def handle_all_errors(exception) # Rails.logger.error "OXEN -------------- %s" % exception.message # redirect_to (request.referrer || "/pages/error") # end end
Version data entries
21 entries across 21 versions & 1 rubygems