[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

caches_page

Kris Kohlstedt

7/22/2007 5:02:00 AM

I'm looking for something that has similar functionality to the
caches_page directive provided by rails but that caches a seperate based
on the params that are passed into the request. For example if I have a
request http://www.foo.com/mycontr... and a request
http://www.foo.com/mycontr... I'd like a seperate cache for each
of those requests. Based on my experimentation with caches_page it
looks like all I get by default is a cache for the first of those 2
requests that is called.

Ideas? Is there a simple way for caches_page to take into account the
params that are passed in?

--
Posted via http://www.ruby-....

1 Answer

Travis D Warlick Jr

7/23/2007 12:38:00 AM

0

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Kris Kohlstedt wrote:
> I'm looking for something that has similar functionality to the
> caches_page directive provided by rails but that caches a seperate based
> on the params that are passed into the request. For example if I have a
> request http://www.foo.com/mycontr... and a request
> http://www.foo.com/mycontr... I'd like a seperate cache for each
> of those requests. Based on my experimentation with caches_page it
> looks like all I get by default is a cache for the first of those 2
> requests that is called.
>
> Ideas? Is there a simple way for caches_page to take into account the
> params that are passed in?

Instead of calling http://www.foo.com/mycontr..., call
http://www.foo.com/mycontroll.... Rails will place '2' into params[:id],
and it will cache the page into public/mycontroller/index/2.html

That is assuming you haven't deleted this line from the end of your
config/routes.rb:

map.connect ':controller/:action/:id'



- --
Travis Warlick

"Programming in Java is like dealing with your mom --
it's kind, forgiving, and gently chastising.
Programming in C++ is like dealing with a disgruntled
girlfriend -- it's cold, unforgiving, and doesn't tell
you what you've done wrong."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail....

iD8DBQFGo/hOWvapaOIz2YYRAlAHAJsEmZ0Ct3erw/QirlpwoC0lHc6mEwCfcYjG
CdY1L3+XMlVVcHYm/K4F1B8=
=ZKGP
-----END PGP SIGNATURE-----