title: Trying to add current_user.admin in my Rails app
body: <p>I am rolling my own auth (auth from scratch) for a Rails 6 app. Here is the current code I have:</p>
  <pre><code>class ApplicationController &lt; ActionController::Base
      private
  
    def current_user
      @current_user ||= User.find(session[:user_id]) if session[:user_id]
    end
    helper_method :current_user
  
    def authorize
      redirect_to login_url, alert: &quot;Not Authorized&quot; if current_user.nil?
    end
    
      #roles will correspond to user types: admin, student, mentor, ect. 0 is most restrictive (student);
      #5 is most powerful (admins)
    def admin
      if current_user.role != 5
          redirect_to welcome_path, alert: &quot;Not Authorized&quot;
      else
          true
      end
    end
  </code></pre>
  <p>...and in my controller I have:</p>
  <pre><code>class UsersController &lt; ApplicationController
    before_action :set_user, only: %i[ show edit update ]
    before_action :authorize, only: :index
  
    def index
      if admin
        @users = User.all
      else
        redirect_to welcome_path, notice: &quot;Thank you for signing up!&quot;
      end
    end
  ...
  </code></pre>
  <p>My question is about calling <code>admin</code> in the index controller. I feel like this should be <code>current_user.admin</code> instead. Can I configure the admin method in the application controller to work like this?</p>