ActionCaching broken in 2.2.2 ?

Hey guys,

    I'm putting together my next Scaling Rails envycast (which may get released for free), and I'm running into what appears to be a bug with Rails 2.2.2 when ActionCaching. I looked for a bug report which addresses this, but I have been unable to find one, so I thought I'd share on here. Here's the gist:

class PostsController < ApplicationController     caches_action :show end

and when it's hit I see this in the log:

I tried to track down the offending code, but ran out of time. Is someone aware of this issue?

I don't really use action caching so I haven't noticed this, but it does sound nasty. Can you give us a lighthouse ticket with a failing test, prehaps git bisect can find it.

The Changes to caching in edge are pretty minimal, so I'm guessing it's related to routing not caching. Where does url_for :controller=>'posts', :action=>'show', :id=>1 go?

What does your route declaration look like?

Another case where action caching is broken is when you specify :cache_path explicitly as string:

caches_action :show, :cache_path => ‘http://test.host/custom/show

We’re using this to cache expensive XML documents and after cache hits, they’re being served as text/html.

Ticket with patch: http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1585-action-caching-sets-wrong-content-type-when-cache_path-is-a-string

This is broken in edge as well as 2.2.2. Thanks,

Mislav

I don't really use action caching so I haven't noticed this, but it does sound nasty. Can you give us a lighthouse ticket with a failing test, prehaps git bisect can find it.

The Changes to caching in edge are pretty minimal, so I'm guessing it's related to routing not caching. Where does url_for :controller=>'posts', :action=>'show', :id=>1 go?

What does your route declaration look like?

I've been looking into this and found that removing the default routes (map.connect ':controller/:action/:id') will fix the problem. Unfortunately I'm not sure why just yet.

Cheers, Brad