Sha256: 197eb4f0a6bfa772a4b27214dec2288c5fb8ca17a4f0a491eea0919b8674c0d3

Contents?: true

Size: 605 Bytes

Versions: 9

Compression:

Stored size: 605 Bytes

Contents

# frozen_string_literal: true

class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception

  rescue_from CanCan::AccessDenied do |exception|
    if user_signed_in?
      Rails.logger.debug "Access denied on #{exception.action} "\
                         "#{exception.subject.inspect}"
      flash.now[:error] = exception.message
      render '403', status: :forbidden, layout: 'application'
    else
      redirect_to(
        main_app.root_url,
        flash: {
          error: 'You must sign in or sign up to access this content.'
        }
      )
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
date_book-0.1.4 spec/dummy/app/controllers/application_controller.rb
date_book-0.1.3 spec/dummy/app/controllers/application_controller.rb
date_book-0.1.1 spec/dummy/app/controllers/application_controller.rb
date_book-0.1.0 spec/dummy/app/controllers/application_controller.rb
date_book-0.0.6 spec/dummy/app/controllers/application_controller.rb
date_book-0.0.5 spec/dummy/app/controllers/application_controller.rb
date_book-0.0.3 spec/dummy/app/controllers/application_controller.rb
date_book-0.0.2 spec/dummy/app/controllers/application_controller.rb
date_book-0.0.1 spec/dummy/app/controllers/application_controller.rb