Michael Bannister wrote:
the content between the helper and end tags?
Unfortunately yes. Inside my_helper, use capture and yield. The return
of capture(yield), IIRC, is the HTML.
capture is sensitive to call because eRB mangles your HTML before
it, and capture naturally sees the mangled version. Google for capture
see how to use it. Then use <%= my_helper, and return your version of
And please reconsider. There’s always a way to write the correct HTML
first time; you shouldn’t want to search and replace inside it. For
<% my_helper do |creator| %>
<%= creator.create_html %>
<% end %>
Now my_helper initializes a creator, and this creates more HTML and
it into the block. This is generally what blocks are for - to mix and
objects from outside the block (like eRB) with objects inserted into the
block by the goal-posts operator ||.
“Test Driven Ajax (on Rails)”