# Page Caching appears to cause certain actions to render blan

**URL:** <https://www.ruby-forum.com/t/page-caching-appears-to-cause-certain-actions-to-render-blan/90928>\
**Category:** Rails\
**Created:** [April 3, 2007, 2:25am UTC](https://www.ruby-forum.com/t/page-caching-appears-to-cause-certain-actions-to-render-blan/90928 "2007-04-03T02:25:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tharealpatton](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tharealpatton](https://www.ruby-forum.com/u/tharealpatton)\
**Post date:** [April 3, 2007, 2:25am UTC](https://www.ruby-forum.com/t/page-caching-appears-to-cause-certain-actions-to-render-blan/90928/1 "2007-04-03T02:25:04Z")

</div>

Hi,

I’m wondering if anyone else has experienced this…

I have a controller with three actions, and I want to cache only the  
action named index. At the top of the controller I have:

caches\_page :index

The index action loads and caches fine, however the other two actions  
in the controller now render as blank pages. In my development log, i  
get this:

Processing MyController#blank\_page (for 127.0.0.1 at 2007-04-02  
17:10:06) [GET]  
Session ID: 43b02585893271eaf440ad31061176bf  
Parameters: {“action”=\>“blank\_page”, “controller”=\>“my”}  
Filter chain halted as  
[#\<ActionController::Filters::ClassMethods::ProcFilter:0x33d608c  
@filter=#Proc:0x033d61e0@:1(eval)\>] returned false.  
Completed in 0.00015 (6797 reqs/sec) | [[http://0.0.0.0/my/blank\_page](http://0.0.0.0/my/blank_page)]

I understand that when the filter chain is halted like that, there a  
before filter returning false for some reason, but I disabled the only  
before filter I have in the application when this started happening,  
so I know it’s not that returning false.

Stranger still (to me at least), if I change the “caches\_page”  
declaration at the top of the controller to cache all the actions, all  
the actions render blank, with that same message in the logs.

Any ideas as to what might be happening here? I’ve gotten this error  
on Rails 1.2.1 and 1.2.3.

Thanks in advance.

Best, PJ

---

<div class="post-metadata">

**Author:** ![tharealpatton](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tharealpatton](https://www.ruby-forum.com/u/tharealpatton)\
**Post date:** [April 3, 2007, 3:03am UTC](https://www.ruby-forum.com/t/page-caching-appears-to-cause-certain-actions-to-render-blan/90928/2 "2007-04-03T03:03:06Z")

</div>

PJ,

Do you specify in your environment.rb where the cached pages are  
supposed to be held? Mine looks a little something like this:

config.action\_controller.page\_cache\_directory = RAILS\_ROOT + “/public/  
cache/”

Sincerely,

Robert D.  
[http://www.techcfl.com](http://www.techcfl.com)

> **[Discover Top Website Tutorials & Guides – Key Medium](https://keymedium.com/category/tutorials-guides/)**
>
> These website tutorials and ultimate guides serve as a resource to help you make informed decisions on website design, development, and redesign projects.

---

<div class="post-metadata">

**Author:** ![tharealpatton](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tharealpatton](https://www.ruby-forum.com/u/tharealpatton)\
**Post date:** [April 3, 2007, 3:11am UTC](https://www.ruby-forum.com/t/page-caching-appears-to-cause-certain-actions-to-render-blan/90928/3 "2007-04-03T03:11:07Z")

</div>

Robert,

Thanks for your reply.

Currently, I do specify the following in my environment.rb

config.action\_controller.page\_cache\_directory = RAILS\_ROOT+"/public/  
cache/"

However, it happens whether or not I do this. This has happened in  
two other apps of mine where I’m not specifying a custom cache  
directory.

Any ideas?

Best, PJ

---

<div class="post-metadata">

**Author:** ![tharealpatton](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tharealpatton](https://www.ruby-forum.com/u/tharealpatton)\
**Post date:** [April 3, 2007, 2:09pm UTC](https://www.ruby-forum.com/t/page-caching-appears-to-cause-certain-actions-to-render-blan/90928/4 "2007-04-03T14:09:20Z")

</div>

PJ,

One other thing to check is whether or not you have write access to  
that directory. Also, does caching work in development mode? Can you  
show come log output for the action? That may help us to figure this  
out.

- Robert

---

<div class="post-metadata">

**Author:** ![tharealpatton](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tharealpatton](https://www.ruby-forum.com/u/tharealpatton)\
**Post date:** [April 3, 2007, 6:18pm UTC](https://www.ruby-forum.com/t/page-caching-appears-to-cause-certain-actions-to-render-blan/90928/5 "2007-04-03T18:18:38Z")

</div>

Hi Robert,

Yeah, permissions seem to be fine. They are set at 755 for the  
directories in my public folder.

So, to recap what’s happening, with a little more detail…In both  
development and production environments, when I have page caching on  
the first (index) action, caching works as expected for that action,  
but all other actions in the controller don’t render because something  
in the Filter Chain is returning false (see log output below). This  
filter chain returns false in development mode whether or not caching  
is actually set to true in config/environments/development.rb (the  
first action doesn’t get cached though unless it is set to true).

Thanks so much for your help!

Development Log:

Processing OurFleetController#index (for 127.0.0.1 at 2007-04-03  
09:07:56) [GET]  
Session ID: 706fe3fcd29909cec43a17d70c1fa2da  
Parameters: {“action”=\>“index”, “controller”=\>“our\_fleet”}  
Rendering within layouts/site  
Rendering our\_fleet/index  
Rendered our\_fleet/\_includes (0.00182)  
Rendered our\_fleet/\_ujs (0.03645)  
Rendered our\_fleet/\_jet\_thumbs (0.00434)  
Rendered our\_fleet/\_jet\_thumbs (0.00167)  
Rendered our\_fleet/\_jet\_thumbs (0.00263)  
Rendered our\_fleet/\_jet\_thumbs (0.00248)  
Rendered our\_fleet/\_jet\_thumbs (0.00101)  
Rendered /layouts/\_head (0.00009)  
Rendered /layouts/\_header (0.00040)  
Rendered /layouts/\_menu (0.00213)  
Rendered /layouts/\_sidebar (0.00012)  
Rendered /layouts/\_footer (0.00077)  
Completed in 0.37697 (2 reqs/sec) | Rendering: 0.06067 (16%) | DB:  
0.25131 (66%) | 200 OK [[http://0.0.0.0/our\_fleet](http://0.0.0.0/our_fleet)]

Processing OurFleetController#jet (for 127.0.0.1 at 2007-04-03  
09:08:11) [POST]  
Session ID: 706fe3fcd29909cec43a17d70c1fa2da  
Parameters: {“jet”=\>“falcon-2000”, “jet\_type”=\>“full-size”,  
“action”=\>“jet”, “controller”=\>“our\_fleet”}  
Filter chain halted as  
[#\<ActionController::Filters::ClassMethods::ProcFilter:0x3534ab4  
@filter=#Proc:0x03534c30@:1(eval)\>] returned false.  
Completed in 0.00014 (7358 reqs/sec) | DB: 0.00000 (0%) | [http://  
0.0.0.0/our\_fleet/full-size/falcon-2000]

Production Log:

Processing OurFleetController#index (for 127.0.0.1 at 2007-04-03  
09:00:48) [GET]  
Session ID: 706fe3fcd29909cec43a17d70c1fa2da  
Parameters: {“action”=\>“index”, “controller”=\>“our\_fleet”}  
Rendering within layouts/site  
Rendering our\_fleet/index  
Completed in 1.52917 (0 reqs/sec) | Rendering: 0.05797 (3%) | DB:  
0.82278 (53%) | 200 OK [[http://0.0.0.0/our\_fleet](http://0.0.0.0/our_fleet)]

Processing OurFleetController#jet (for 127.0.0.1 at 2007-04-03  
09:01:08) [POST]  
Session ID: 706fe3fcd29909cec43a17d70c1fa2da  
Parameters: {“jet”=\>“citation-x”, “jet\_type”=\>“super-mid-size”,  
“action”=\>“jet”, “controller”=\>“our\_fleet”}  
Filter chain halted as  
[#\<ActionController::Filters::ClassMethods::ProcFilter:0x35ea2c4  
@filter=#Proc:0x035ea418@:1(eval)\>] returned false.  
Completed in 0.00017 (5882 reqs/sec) | DB: 0.00000 (0%) | [http://  
0.0.0.0/our\_fleet/super-mid-size/citation-x]

---

<div class="post-metadata">

**Author:** ![tharealpatton](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tharealpatton](https://www.ruby-forum.com/u/tharealpatton)\
**Post date:** [April 4, 2007, 11:54pm UTC](https://www.ruby-forum.com/t/page-caching-appears-to-cause-certain-actions-to-render-blan/90928/6 "2007-04-04T23:54:18Z")

</div>

I finally discovered that the issue was being caused by the  
unobtrusive javascript plugin. A quick look on their google group  
revealed a solution. FYI, the fix is in the trunk but not included in  
the current release.

[http://groups.google.com/group/ujs4rails/browse\_thread/thread/f93ea937cd8a6c12](http://groups.google.com/group/ujs4rails/browse_thread/thread/f93ea937cd8a6c12)

---

<div class="post-metadata">

**Author:** ![tharealpatton](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tharealpatton](https://www.ruby-forum.com/u/tharealpatton)\
**Post date:** [April 5, 2007, 2:53am UTC](https://www.ruby-forum.com/t/page-caching-appears-to-cause-certain-actions-to-render-blan/90928/7 "2007-04-05T02:53:32Z")

</div>

Rock. Thank you for sharing that one.

- Robert
