My form_tag looks like:
<%= form_tag(:controller => "users", :action => "confirm", :method => "get") %>
the html output is:
<form accept-charset="UTF-8" action="/users/confirm?method=get" method="post">
Why is it doing this?
This can be used for: creating new database records, building a contact form, integrating a search engine field, and pretty much every other aspect of the application that requires user input. When it comes to forms in Rails, you will discover that you will have the flexibility to utilize: Built-in form helper methods.
Forms in web applications are an essential interface for user input. However, form markup can quickly become tedious to write and maintain because of the need to handle form control naming and its numerous attributes. Rails does away with this complexity by providing view helpers for generating form markup.
I think it's because when used in this form it assumes all of the options are url options. Try.
<%= form_tag( '/users/confirm', :method => :get ) %>
In this case you have two separate sets of options, url options and tag options.
The first 2 parameters of form_tag
are url_for_options
and options
. Both are hash. So in your code, the whole hash is taken as url_for_options
. So, to separate the parameters, you have to do like this:
<%= form_tag({:controller => "users", :action => "confirm"}, {:method => "get"}) %>
or
<%= form_tag({:controller => "users", :action => "confirm"}, :method => "get") %>
Refer link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With