Ruby on Rails Tuesday, November 30, 2010

Hi there,

I'm using Action Caching with Rails 2.3.8 on Heroku with Memcached
(via Dalli Gem).

Without the layout parameter Action Caching works fine. However, as
soon as I add layout => false I get problems: Normal non-ajax requests
are cached fine, without the layout, as expected. But ajax requests
are not properly cached: I get cache misses all the time. Then, when I
log in to my app neither normal, nor ajax requests are cached at all.

I also tried to set :layout => { |c| c.request.xhr? }
When I do that ajax and normal requests are properly cached (no matter
if logged out or logged in)
but normal requests also cache the layout. Seems odd to me as normal
requests should have :layout => false.
I'm trying to debug this for hours now, but I haven't got a clue
what's going on so far. What especially confuses me
is that the logged in state of my app apparently has an influence on
the caching behaviour.

Here is my full caching call (for the case of layout => false):

[code]caches_action :index, :layout => false,
:cache_path => { |c|
c.params.clone.delete_if { |k,v| ['authenticity_token'].include?
(k) }.merge(:xhr => c.request.xhr? ? 't' : 'f') }[/code]

I'd greatly appreciate any help on this!


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
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment