title: Conditional layout and action caching without a layout
body: <p>I have an action on a controller where I'm using action caching. However I'm using the <code>layout: false</code> flag on that caching call since my layout has user dependent information like login status. This works perfectly.</p>
  
  <p>Then I was adding the pjax-rails gem, which basically adds this code to the controller:</p>
  
  <pre><code>layout -&gt;(c) { pjax_request? ? false : 'application' }
  </code></pre>
  
  <p>That is on some requests the layout isn't rendered. Now I (kinda logically) want to combine these two approaches together.</p>
  
  <p>However when <code>pjax_request? == true</code> I get this error:</p>
  
  <blockquote>
    <p>There was no default layout for MyController</p>
  </blockquote>
  
  <p>What am I doing wrong and how can I solve this problem?</p>
  
  <hr>
  
  <p>PS: This is easiest reproducible in this case:</p>
  
  <pre><code>class MyController &lt; ApplicationController
    layout false
    caches_action :index, :layout =&gt; false
  
    def index
    end
  end
  </code></pre>