Sha256: c0f63765c9b73dc6d25fc0c91cab65e33226445bf39defb398059fe840c72bad

Contents?: true

Size: 1.17 KB

Versions: 15

Compression:

Stored size: 1.17 KB

Contents

require 'pundit'
require 'exceptions'
#
class ApplicationController < ActionController::Base

  #
  # if you need a beta of some views - but with production data
  #
  # before_filter :setup_beta
  #
  # def setup_beta
  #   if request.subdomain == "beta"
  #     prepend_view_path "app/views/beta"
  #     # other beta setup
  #   end
  # end


  # 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

15 entries across 15 versions & 1 rubygems

Version Path
abstracted-0.4.22 app/controllers/application_controller.rb
abstracted-0.4.21 app/controllers/application_controller.rb
abstracted-0.4.20 app/controllers/application_controller.rb
abstracted-0.4.19 app/controllers/application_controller.rb
abstracted-0.4.18 app/controllers/application_controller.rb
abstracted-0.4.17 app/controllers/application_controller.rb
abstracted-0.4.16 app/controllers/application_controller.rb
abstracted-0.4.15 app/controllers/application_controller.rb
abstracted-0.4.14 app/controllers/application_controller.rb
abstracted-0.4.13 app/controllers/application_controller.rb
abstracted-0.4.12 app/controllers/application_controller.rb
abstracted-0.4.10 app/controllers/application_controller.rb
abstracted-0.4.9 app/controllers/application_controller.rb
abstracted-0.4.8 app/controllers/application_controller.rb
abstracted-0.4.7 app/controllers/application_controller.rb