Rails Action and Fragment Caching during Development?

Posted by viatropos on Stack Overflow See other posts from Stack Overflow or by viatropos
Published on 2010-03-29T02:20:33Z Indexed on 2010/03/29 2:23 UTC
Read the original article Hit count: 476

Filed under:
|
|

I'm just starting to get into Rails caching and am wondering how to test whether or not caching is working in my development environment.

I have set these two config variables for both the development (temporarily) and production environments:

config.action_controller.perform_caching = true
config.action_controller.page_cache_directory = 
 File.join(RAILS_ROOT, 'public', 'cache')

And my controller basically looks like this (using the resource_controller gem):

class EventsController < Spree::BaseController
 resource_controller
 caches_page :index

 index.response do |format|
  format.html
  format.xml { render :xml => @collection.to_xml }
 end

 # ...
end

If I do that, I get these files:

  • public/cache/events.html
  • public/cache/events.xml

But when I change caches_page to caches_action, I don't see any generated files and am not sure how to tell if the response has been cached. What do I need to know to know that this is working?

I've read the docs and related, the rails caching guides, the railscast, and a few other docs, but I'm still wondering where everything is stored.

Thanks!

© Stack Overflow or respective owner

Related posts about rails

Related posts about action-caching