form_tag block in a helper-method
Posted by michael.schaerfer on 24-Jul-08 at 07:45
According to this Ticket, using form_tag with a block in a helper-method is broken in rails 2.1.
Here is a, not so elegant but working, solution:
1 def render_form_tag_in_helper( _erbout, url, *args ) 2 form_tag( url ) do 3 concat( submit_tag("button"), binding ) 4 end 5 endWe have to pass the _erbout-variable to the helper-method in order to make the form_tag-method work. And to add elements to the form (submit_buttons, text_fields, etc), we have to call concat (to add the elements to the _erbout variable) with the current binding.

Comments
There are 0 comments on this post. Post yours →
Post a comment
Required fields in bold.