class Admins::BaseController < ApplicationController include Admins::PaginateHelper include Admins::RenderHelper include Admins::ErrorRescueHandler layout 'admin' before_action :require_login, :require_admin! private def require_login return if User.current.logged? redirect_to "/login?back_url=#{CGI::escape(request.fullpath)}" end def require_admin! return if current_user.blank? || !current_user.logged? return if current_user.admin_or_business? render_forbidden end end