I''d having my first tries at caching in Rails, and would like to experiment with fragmentcaching. I have some problems with getting any results and i don''t know exactly what''s going on now. I have this in my development.rb... config.action_controller.perform_caching = true config.action_controller.cache_store = :file_store, RAILS_ROOT + "/public/cache/" and this is my layout-viewfile... - cache "main_menu" do = render :partial => ''menu'' I see nothing happening though, and no files appear in public/cache, so i''m wondering if i overlooked something. The menu-partial loops through all categories (it has a Category.find(:all).each in it) but i still see that SQL-query in my terminal. --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
You messed up the cache_store setting a bit. # /config/environments/development.rb config.action_controller.perform_caching = true config.action_controller.fragment_cache_store = [:file_store, "#{RAILS_ROOT}/tmp/cache"] Then make sure to restart the server. That really should work as long as the "find" action is contained directly within the partial and is not done in the controller. -- 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?hl=en -~----------~----~----~----~------~----~------~--~---
hmmm, i''m getting a undefined method `cache_fragment'' for #<Haml::Template:0x2647a74> when i do that. is haml in the way? On Mar 10, 1:00 am, Nathan Esquenazi <rails-mailing-l...@andreas- s.net> wrote:> You messed up the cache_store setting a bit. > > # /config/environments/development.rb > config.action_controller.perform_caching = true > config.action_controller.fragment_cache_store = [:file_store, > "#{RAILS_ROOT}/tmp/cache"] > > Then make sure to restart the server. > > That really should work as long as the "find" action is contained > directly within the partial and is not done in the controller. > > -- > Posted viahttp://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?hl=en -~----------~----~----~----~------~----~------~--~---
No, I am developing with HAML and I use fragment caching all the time. Are you using Rails 2.0.2. It should work like this: # config/environments/development.rb config.action_controller.perform_caching = true config.action_controller.fragment_cache_store = [:file_store, "#{RAILS_ROOT}/tmp/cache"] # app/views/example/something.html.haml #... - cache(:controller => "example", :action => "something") do <div id="some_section"> this section will be cached </div> #... That is how I have it all throughout my app and it seems to work. -- 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?hl=en -~----------~----~----~----~------~----~------~--~---
Make sure you have the latest version of haml as well. Haml 1.8.2 -- 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?hl=en -~----------~----~----~----~------~----~------~--~---