Sha256: 27ffbab9e85c006df43a94c702aa78fdf81f9068dd0dcdded9a0a016b7f4eb75

Contents?: true

Size: 770 Bytes

Versions: 9

Compression:

Stored size: 770 Bytes

Contents

# frozen_string_literal: true

module EacRailsBase0
  class ApplicationController < ActionController::Base
    include ::CanCanDry::ControllerAuthorization

    layout 'eac_rails_base0/application'
    helper ::EacRailsBase0::LayoutHelper

    # Prevent CSRF attacks by raising an exception.
    # For APIs, you may want to use :null_session instead.
    protect_from_forgery with: :exception

    before_action :authorize_by_ability_mapping

    rescue_from CanCan::AccessDenied do |exception|
      if current_user
        flash[:error] = "Conteúdo indisponível: #{exception}"
        redirect_to main_app.root_url
      else
        flash[:danger] = 'Por favor faça o login.'
        redirect_to eac_users_support.new_user_session_path
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
eac_rails_base0-0.13.1 app/controllers/eac_rails_base0/application_controller.rb
eac_rails_base0-0.13.0 app/controllers/eac_rails_base0/application_controller.rb
eac_rails_base0-0.12.0 app/controllers/eac_rails_base0/application_controller.rb
eac_rails_base0-0.11.0 app/controllers/eac_rails_base0/application_controller.rb
eac_rails_base0-0.9.0 app/controllers/eac_rails_base0/application_controller.rb
eac_rails_base0-0.8.0 app/controllers/eac_rails_base0/application_controller.rb
eac_rails_base0-0.7.0 app/controllers/eac_rails_base0/application_controller.rb
eac_rails_base0-0.6.0 app/controllers/eac_rails_base0/application_controller.rb
eac_rails_base0-0.5.0 app/controllers/eac_rails_base0/application_controller.rb