title: Rails: In Application Controller, force login, redirect all requests except login
body: <p>I'd like a simple method in my application controller that requires all users to log in before continuing to any part of the site. I'm using Devise for authentication.</p>
  
  <p>I tried:</p>
  
  <pre><code>class ApplicationController &lt; ActionController::Base
    ...
    unless user_signed_in?
      redirect_to login_path
    end
    ...
  end
  </code></pre>
  
  <p>This successfully redirects everyone, but the problem is it also prevents the post request necessary to create a new user session.</p>
  
  <p>So my question is, how would you go about blocking all requests except for the login view and the post request for logging in?</p>