RE: [Rails] Re: using form_tag inside a helper

Ball, Donald A Jr (Library) wrote:
> The proper usage of form_tag nowadays is:
>
> <% form_tag do %>
> blah blah blah
> <% end %>
>
> Supposing I want to use form_tag inside a helper, e.g.
>
> def search_form
> form_tag do
> ... ??? ...
> end
> end
>
> what would I put inside the block? In my other helpers, I
build up a
> string and return it.
>
> - donald
>

I've been wondering this too! Nothing I've done seems to work.
Only downside I've found to the new way.

Poking through the source, I note that the form_tag method uses the
concat method if a block is given, which looks like it ends up writing
directly to _erbout (via an eval call - which would seem to be an overly
slow way of going about it...) Absent a quick redef of that method
around the form_tag call, I don't see a way to use form_tag inside a
helper. Tch.

- donald