module Admin class BaseController < ActionController::Base include Pagy::Backend include AdminAuthentication # Enable session and flash for admin controllers # (needed because the app is in API-only mode) protect_from_forgery with: :exception layout "admin" before_action :require_admin helper_method :current_admin, :logged_in? private def require_admin redirect_to admin_login_path, alert: "Please log in to continue" unless logged_in? end end end