title: Ruby on Rails: undefined method `current_user?`
body: <p>I'm having issues trying to figure out why i'm getting <code>undefined method</code>current_user?'`</p>
  
  <p>In my Application controller:</p>
  
  <pre><code>class ApplicationController &lt; ActionController::Base
    protect_from_forgery
    include SessionsHelper
  
    # Force signout to prevent CSRF attacks
    def handle_unverified_request
      sign_out
      super
    end
  
     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: "Not Autherized" if current_user.nil?
    end
  
    def track_activity(trackable, action = params[:action])
      current_user.activities.create! action: action, trackable: trackable
    end
  end
  </code></pre>
  
  <p>In my session helper:</p>
  
  <pre><code>module SessionsHelper
    def sign_in(user)
      cookies.permanent[:remember_token] = user.remember_token
      self.current_user = user
    end
    def signed_in?
      !current_user.nil?
    end
    def current_user=(user)
      @current_user = user
    end
    def current_user
      @current_user ||= User.find_by_remember_token(cookies[:remember_token])
    end
  
    def sign_out
      self.current_user = nil
      cookies.delete(:remember_token)
    end
  end
  </code></pre>
  
  <p>I'm still new to rails I'm following some tutorials, but I'm trying to figure out why I'm getting undefined method for current_user?</p>
  
  <p>This is where my error is occurring- users view folder:</p>
  
  <pre><code>&lt;% unless current_user?(@user) %&gt;
    &lt;div id="follow_form"&gt;
    &lt;% if current_user.following?(@user) %&gt;
      &lt;%= render 'unfollow' %&gt;
    &lt;% else %&gt;
      &lt;%= render 'follow' %&gt;
    &lt;% end %&gt;
    &lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>