I have an action on a controller where I'm using action caching. However I'm using the `layout: false` flag on that caching call since my layout has user dependent information like login status. This works perfectly.

Then I was adding the pjax-rails gem, which basically adds this code to the controller:

```
layout ->(c) { pjax_request? ? false : 'application' }

```

That is on some requests the layout isn't rendered. Now I (kinda logically) want to combine these two approaches together.

However when `pjax_request? == true` I get this error:

> 
> There was no default layout for MyController
> 
> 
> 

What am I doing wrong and how can I solve this problem?

---

PS: This is easiest reproducible in this case:

```
class MyController < ApplicationController
  layout false
  caches_action :index, :layout => false

  def index
  end
end

```