Created
January 3, 2019 17:29
-
-
Save infernalmaster/3429d08e49e06fa7a7201a1b1c7b51b4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
include Pundit | |
protect_from_forgery with: :exception | |
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized | |
private | |
def user_not_authorized | |
flash[:alert] = 'You are not authorized to perform this action.' | |
redirect_back(fallback_location: root_path) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment