cdn/app/controllers/admin/application_controller.rb
2026-01-30 13:45:56 -05:00

14 lines
297 B
Ruby

module Admin
class ApplicationController < ::ApplicationController
before_action :require_admin!
private
def require_admin!
redirect_to(
root_path,
alert: "You need to be an admin to access this page."
) unless current_user&.is_admin?
end
end
end