title: before_filter and respond_to formats
body: <p>In a controller in my Rails app, I can do this:</p>
  
  <pre><code>before_filter :login_required, :except =&gt; :index
  </code></pre>
  
  <p>But I would like to apply the filter not only based on the action name but on the format of the request. In other words, I would like to do something like this:</p>
  
  <pre><code>before_filter :login_required, :except =&gt; {:action =&gt; :index, :format =&gt; :js}
  </code></pre>
  
  <p>Is this possible?</p>