I’m trying to build a helper that takes a block from the view (like
form_for).
Here’s what I have so far:
def basic_filters &block
html = Builder::XmlMarkup.new
html.p(:class => “filters”) do
html.button(:class => “filter_change”) { html.img(:src =>
“/images/chop_closed.gif”) }
html << “Advanced Filter …”
end
html.div(:class => “filters”) do
html.button(:class => “filter_change”) { html.img(:src =>
“/images/chop_open.gif”) }
html << yield
end
concat(html, block.binding)
end
It works fine, except that the yield call in the helper seems to render
the block as well. So I end up with the block’s contents, followed by
the return from the helper (which contains the block’s contents).