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@(eval):1>>] returned false.
Completed in 0.00015 (6797 reqs/sec) | [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.
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.
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).
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.