File size: 335 Bytes
5010ad7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | module Admin
class AdminController < ApplicationController
include Pagy::Method
before_action :authenticate_user!
before_action :require_admin!
layout "admin"
private
def require_admin!
redirect_to localized_root_path, alert: t("errors.not_authorized") unless current_user&.admin?
end
end
end
|