Caching pages

Hey,

I want to cache pages…
I have this function show, and on top of my page I have the cache stuff.
But it doesnt seem to work. Cuz I saw still queries in the development
log file. Can anyone help me?
I have tried caches_page and caches_action

And what about parameters like /show/1, /show/2, /show/3 =>> need to be
different caches. Does anyone has any good full example?

class Frontend::ProductsController < FrontEndController

caches_page :show
#caches_action :show

def show
@product = Product.find(:first, :conditions => [‘id = ?’, params[:id]])
if @product == nil
redirect_to :action => ‘list’
end
end

end

Thx
N.

Hey,

I want to cache pages…
I have this function show, and on top of my page I have the cache stuff.
But it doesnt seem to work. Cuz I saw still queries in the development
log file. Can anyone help me?

Caching isn’t enabled in development mode…

Set config.action_controller.perform_caching to true in
config/environments/development.rb if you want to see how it works.

Or switch your environment to production…

-philip

Caching is by default turned off in development environment,
In your config/environments/production.rb file it sets some
caching settings to true, meaning it works only in production mode

Hope this helps!
Gustav
[email protected]

That works :wink:

Thx
N.

Brutyn N. wrote:

end

end

Thx
N.

Caching is by default turned off in development environment,
In your config/environments/production.rb file it sets some
caching settings to true, meaning it works only in production mode

Hope this helps!
Gustav
[email protected]


about me:
My greatest achievement was when all the other
kids just learnt to count from 1 to 10,
i was counting (0…9)

  • gustav.paul

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs