Getting Rails' Caching Working with Markaby?

I’ve also posted this to the Camping (no response to my latest) and core
(hasn’t shown up) lists, but want to see if anybody here might have any
insights. :slight_smile:

Trying to use Rails’ caching with Markaby, I get errors like this:

ActionView::TemplateError
(/usr/lib/ruby/gems/1.8/gems/markaby-0.5/lib/markaby/builder.rb:192:in
method_missing': no such methodlength’) on line #0 of
app/views/items/index.mab:
1:
2: cache("#{@site.server_name}/index_items") do

Tim replied:

Yep, the length error is because a lot of Rails’
internals still assume ERB, which uses a different buffer structure
to Markaby. I’ll try to get it working soon.

And I replied:

Do you have any ideas how to approach it? Looking at
Rails’ code:

  # Called by CacheHelper#cache
  def cache_erb_fragment(block, name = {}, options

= nil)
unless perform_caching then block.call; return
end

    buffer = eval("_erbout", block.binding)

    if cache = read_fragment(name, options)
      buffer.concat(cache)
    else
      pos = buffer.length
      block.call
      write_fragment(name, buffer[pos..-1],

options)
end
end

It seems like Markaby might have to have a “length”
attribute and/or act like “buffer”? Or would Rails
need to be changed on the eval line?

Anybody have any ideas on getting caching working with Markaby?

Thanks,
Joe

There is a ticket http://code.whytheluckystiff.net/markaby/ticket/5
which is perhaps related. Try applying the patch?

Vish