Fragment caching seems to be broken on 2.2.2

Trying to do ...

<% cache do %>    <%= something_expensive() %> <% end %>

Raises an exception ...

ActionView::TemplateError (undefined local variable or method `_erbout' for #<ActionView::Base:0x3652d24>) on line #31 of app/views/ home/index.html.erb: 28: </div> 29: <div id="threeColWrap"> 30: <div id = "col_1"> 31: <% cache do %> 32: <div id = "col-1-head">

I've tried it on both CentOS 5.2 and OSX 10.5, both configured to run with Rails 2.2.2

I've googled for the error, but all I came across was the same problem reported a year ago in this group ...

http://groups.google.com/group/rubyonrails-core/browse_thread/thread/9864efb24c1dc3c5/a51eca65716d5da2?lnk=gst&q=cache#a51eca65716d5da2

It refers to a ticket on http://dev.rubyonrails.org/ticket/10733 ... but it's a year old.

I find it hard to believe I'm the first person to come across such a basic and presumably important part of rails being broken in 2.2.2 ... but maybe ?.

I'd appreciate any help on how to correct it or work around it ... short of yanking fragment caching from the app.

Thanks.

I'd appreciate any help on how to correct it or work around it ... short of yanking fragment caching from the app.

I'm using fragment caching on a 2.2.2 app and not seeing this problem, and given the nature of your error message I'm guessing it's an old plugin.

Do you have any plugins related to caching or template languages? Have they been updated for 2.2.2? What does the rest of the stacktrace say?

We saw something like this when we had a version of erubis being
required in tucked away corner of one of our initializers, check for
stuff like that as well.

Josh Ferguson

_erbout is used ALL over the place (e.g. capture blocks), so it's probably like what Josh says..

Hey John/Michael,

Thanks for the hints. I'll try and tack it down some more so. I've a ways to go before such issues become second nature.

As long as I can be assured that it's not infact a core issue, just a clash with something on my end, I'll spend more time looking into it.

I'll update this thread if/when I can track it down.

Thanks.

Found it.

Turns out I had the old timed_fragment_cache plugin residing in the code, and though I wasn't actually using it anywhere in my current codeline ... it was still being loaded.

I found a fix for timed_fragment_cache at ruzee.com (http:// www.ruzee.com/blog/2008/07/timed_fragment_cache-on-rails-21/). Steffan points out ... "With Rails 2.1 cache_erb_fragment has been replaced by write_fragment. This breaks a plugin I really enjoy to use: timed_fragment_cache by Richard Livsey".

Steffan updated the plugin to 0.2 and provided it in zipped form on the link above ... and I can confirm that it works fine in rails 2.2.2.

Thanks for the help, and hope the discussion helps someone else :0)

Cheers.