# I don't understand how to cache this

**URL:** <https://www.ruby-forum.com/t/i-dont-understand-how-to-cache-this/114128>\
**Category:** Rails\
**Created:** [September 8, 2007, 10:30am UTC](https://www.ruby-forum.com/t/i-dont-understand-how-to-cache-this/114128 "2007-09-08T10:30:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![snaggy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/cdc98d/32.png) [@snaggy](https://www.ruby-forum.com/u/snaggy)\
**Post date:** [September 8, 2007, 10:30am UTC](https://www.ruby-forum.com/t/i-dont-understand-how-to-cache-this/114128/1 "2007-09-08T10:30:35Z")

</div>

My website is mainly a single controller/action and the menu/page is  
chosen by passing the parameters  
params[‘menu’]  
params[‘submenu’]

after rerouting, the urls look like this:

[www.mywebsite.com/:menu/:submenu](http://www.mywebsite.com/:menu/:submenu)

I’d like to cache every url, since caching the whole action doesn’t  
seem to do anything at all…

How can I approach this problem?  
bye

---

<div class="post-metadata">

**Author:** ![snaggy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/cdc98d/32.png) [@snaggy](https://www.ruby-forum.com/u/snaggy)\
**Post date:** [September 8, 2007, 4:02pm UTC](https://www.ruby-forum.com/t/i-dont-understand-how-to-cache-this/114128/2 "2007-09-08T16:02:08Z")

</div>

Snaggy wrote:

> seem to do anything at all…
> 
> How can I approach this problem?

Sounds like you’re looking for page caching.

The API docs on page caching can be found at:

[http://api.rubyonrails.com/classes/ActionController/Caching/Pages.html](http://api.rubyonrails.com/classes/ActionController/Caching/Pages.html)

–  
Cheers,

- Jacob A.

---

<div class="post-metadata">

**Author:** ![snaggy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/cdc98d/32.png) [@snaggy](https://www.ruby-forum.com/u/snaggy)\
**Post date:** [September 8, 2007, 7:42pm UTC](https://www.ruby-forum.com/t/i-dont-understand-how-to-cache-this/114128/3 "2007-09-08T19:42:39Z")

</div>

thanks, I did it but I still have some problem. I decided that I’ll  
leave this when my app goes on the server now I don’t to get an  
headache for nothing…

thanks  
bye

---

<div class="post-metadata">

**Author:** ![snaggy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/cdc98d/32.png) [@snaggy](https://www.ruby-forum.com/u/snaggy)\
**Post date:** [September 9, 2007, 8:48am UTC](https://www.ruby-forum.com/t/i-dont-understand-how-to-cache-this/114128/4 "2007-09-09T08:48:31Z")

</div>

On Sep 8, 2007, at 7:42 PM, Snaggy wrote:

> thanks, I did it but I still have some problem. I decided that I’ll  
> leave this when my app goes on the server now I don’t to get an  
> headache for nothing…

In what environment are you testing your caching? IIRC caching only  
works in the “production” environment and not in “development”.

Regards,

Sjoerd.
