title: memoization in rails using an instance variable
body: <p>I'm following railstutorial by Michael Hartl. In <a href="https://www.railstutorial.org/book/log_in_log_out#sec-current_user" rel="nofollow">chapter 8.2.2</a> he defines a variable <code>@current_user</code> and a method <code>current_user</code>.</p>
  
  <p>app/helpers/sessions_helper.rb looks like this:</p>
  
  <pre><code>module SessionsHelper
  
    # Logs in the given user.
    def log_in(user)
      session[:user_id] = user.id
    end
  
    # Returns the current logged-in user (if any).
    def current_user
      @current_user ||= User.find_by(id: session[:user_id])
    end
  
  end
  </code></pre>
  
  <p>Hartl defines @current_user an instance variable (of User object I guess); How can @current_user be an instance variable if it is itself an instance of the User class?</p>