module Rostra class ApplicationController < ActionController::Base helper_method :user_logged_in? rescue_from CanCan::AccessDenied do |exception| after_access_denied end # Check if a user is logged in # def user_signed_in? current_user end private # Override cancan's default class of Ability to user Rostra::Ability. # def current_ability @current_ability ||= Rostra::Ability.new(current_user) end # Override this method to if finer control over what happens when cancan denies access. # def after_access_denied redirect_to root_url, alert: "You don't have access to view this page" end end end