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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Brutyn Nick wrote:> 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. > >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 gustav-PUm+PnBUKx7YkQIYctQFYw@public.gmane.org -- 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
> 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> 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. > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
> 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 > gustav-PUm+PnBUKx7YkQIYctQFYw@public.gmane.org > >That works ;) Thx N. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---