# Bug in caches\_action?

**URL:** <https://www.ruby-forum.com/t/bug-in-caches-action/113500>\
**Category:** Rails\
**Created:** [August 31, 2007, 8:23pm UTC](https://www.ruby-forum.com/t/bug-in-caches-action/113500 "2007-08-31T20:23:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![plambert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/9d8465/32.png) [@plambert](https://www.ruby-forum.com/u/plambert)\
**Post date:** [August 31, 2007, 8:23pm UTC](https://www.ruby-forum.com/t/bug-in-caches-action/113500/1 "2007-08-31T20:23:26Z")

</div>

Has anyone actually seen a before filter being called once an action  
is cached with caches\_action? When I try to use caches action, the  
before filter is called only if the action hasn’t already been  
cached. In other words, caches\_action functions much like  
caches\_page. Here is some test code that shows the problem:

class TestCaseController \< ApplicationController  
caches\_action :show  
before\_filter :my\_filter

def my\_filter  
logger.info(‘%%% hi’)  
end

def show  
render(:text=\>‘hello from show’)  
end

end

If you put this into your controllers directory, start your server in  
production mode, and go to [http://localhost:3000/test\_case/show](http://localhost:3000/test_case/show), then  
you will see the “hi” message in the log. However, if you hit reload,  
the “hi” message does not appear a second time. Am I doing something  
wrong?

Thanks,  
–Paul
