hubfeenix.fi/app/controllers/application_controller.rb

14 lines
372 B
Ruby
Raw Normal View History

2022-11-21 11:10:04 +01:00
class ApplicationController < ActionController::Base
2022-12-20 16:29:05 +01:00
2023-01-15 20:50:58 +01:00
include Pundit::Authorization
alias :current_user :current_member #for pundit
2023-01-15 23:17:22 +01:00
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
2023-01-15 20:50:58 +01:00
protected
2023-01-15 23:17:22 +01:00
def user_not_authorized
flash[:alert] = "You are not authorized to perform this action."
redirect_back(fallback_location: root_path)
end
2022-11-21 11:10:04 +01:00
end