# Fragment caching strangely honors the options I pass to it

**URL:** <https://www.ruby-forum.com/t/fragment-caching-strangely-honors-the-options-i-pass-to-it/153232>\
**Category:** Rails\
**Created:** [November 13, 2008, 6:30pm UTC](https://www.ruby-forum.com/t/fragment-caching-strangely-honors-the-options-i-pass-to-it/153232 "2008-11-13T18:30:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [November 13, 2008, 6:30pm UTC](https://www.ruby-forum.com/t/fragment-caching-strangely-honors-the-options-i-pass-to-it/153232/1 "2008-11-13T18:30:49Z")

</div>

Hi,

In my view I have the following cache:

\<%- cache(:controller =\> ‘products’, :action =\> ‘index’, :action\_suffix  
=\> ‘footer’) do -%\>  
…  
\<%- end -%\>

And that’s the file generated:  
tmp/cache/views/www.mysite.com/products.action\_suffix=footer.cache

Why isn’t fragment caching picking up the :index option, and incorrectly  
making use of action\_suffix?

According to the API  
([http://www.railsbrain.com/api/rails-2.1.2/doc/index.html?a=C00000103&name=ActionController::Caching::Fragments](http://www.railsbrain.com/api/rails-2.1.2/doc/index.html?a=C00000103&name=ActionController::Caching::Fragments)),  
I should be getting the following filee:  
tmp/cache/views/www.mysite.com/products/index/footer.cache

Any idea?

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [November 13, 2008, 6:45pm UTC](https://www.ruby-forum.com/t/fragment-caching-strangely-honors-the-options-i-pass-to-it/153232/2 "2008-11-13T18:45:39Z")

</div>

> And that’s the file generated:  
> tmp/cache/views/www.mysite.com/products.action\_suffix=footer.cache

Hmm, according to railsenvy’s tutorial on the topic, it seems correct:  
[http://www.railsenvy.com/2007/3/20/ruby-on-rails-caching-tutorial-part-2#fragment](http://www.railsenvy.com/2007/3/20/ruby-on-rails-caching-tutorial-part-2#fragment)

Maybe it is not making use of the :action option because I have  
developed my app restfully, so /products implicitly triggers the index  
action?
