I have a little challenge that is frustrating me. I am trying to write
a wrapper around cache() so that my fragments get cached with comments
injected at the front and back. Unfortunately it is not as simple as
using “concat(text,block.bindings)” before and after the call to
cache() because then the comments themselves don’t get cached.
Here is what I have right now:
It produces the correct visual output, but the concat results aren’t
part of the cached fragment, they are getting regenerated every time.
What I need to do is something like this:
But I need to give this new block the bindings of the original block,
rather than have it grab a new set of bindings. With the above,
cache() crashes b/c the inner block isn’t in the context of an erb
template, so it’s missing key stuff (specifically _erbout).
“I realised something was wrong when I looked over and saw the mast in
the water.” - Dean Barker, Team New Zealand skipper