I have the following code in a form helper Module:
def form_tag_helper(options = {})
url = url_for(:action => “#{@controller.action_name}”)
“#{self.send(:form_tag, url, options)}”
end
which I call from several views e.g.
<%= form_tag_helper %>
<table>
<%#= form_input :text_field, "login", :size => 30 %><br/>
<%#= form_input :password_field, "password", :size => 30 %><br/
</table>
<div class="button-bar">
<%#= button_helper 'login' %>
<%#= link_helper 'login_signup', :action => 'signup' %>
<%#= link_helper 'login_forgot_password', :action =>
‘forgot_password’ %>
The code – which I have modified from the SaltedHashLoginGenerator
(replace deprecated start_form_tag with form_tag) – seems to generate
an html form correctly. I am however conscious that form_tag (when
used in the manner above) should have a do…end block surrounding the
form elements and the above code does not respect this.
I would appreciate any views on this and suggestions on how I might
add a do…end block.
Thanks!