title: Devise current_user = nil in ApplicationController
body: <p>Here is the full error:</p>
  
  <pre><code>Can't verify CSRF token authenticity
    User Load (0.3ms)  SELECT  `users`.* FROM `users`  WHERE `users`.`id` = 5  ORDER BY `users`.`id` ASC LIMIT 1
     (0.1ms)  BEGIN
     (0.2ms)  COMMIT
  Completed 500 Internal Server Error in 22ms
  
  NoMethodError - undefined method `has_role?' for nil:NilClass:
    app/controllers/application_controller.rb:8:in `authenticate_admin_user!'
  </code></pre>
  
  <p>I can verify that I was logged in at the time with an admin user. </p>
  
  <p>Here is the controller that is triggering the error:</p>
  
  <pre><code>class ApplicationController &lt; ActionController::Base
    def authenticate_admin_user!
      unless current_user.has_role? :admin
        flash[:alert] = "This area is restricted to administrators only."
        redirect_to main_app.root_path 
      end
    end
  </code></pre>