2021-12-18 15:52:01 +01:00
|
|
|
class ApplicationController < ActionController::Base
|
2022-01-22 18:17:44 +01:00
|
|
|
include Authentication
|
2022-01-23 09:52:52 +01:00
|
|
|
include Pundit
|
2022-01-23 16:42:00 +01:00
|
|
|
|
|
|
|
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def user_not_authorized
|
|
|
|
flash[:alert] = "You are not authorized to perform this action."
|
|
|
|
redirect_to(request.referrer || root_path)
|
|
|
|
end
|
2021-12-18 15:52:01 +01:00
|
|
|
end
|