Forum: Ruby on Rails newbie - form_tag with get?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Constantin G. (Guest)
on 2006-03-23 18:39
(Received via mailing list)
I can't create a form with method "get".

The rhtml code:
<%= form_tag :controller => 'teritory', :action => 'add', :method =>
'get'  %>

The generated html code:
<form action="/teritory/add?method=get" method="post">

What i'm doing wrong?


--
They say money can't buy happiness? Look at the smile on my face... ear
to ear, baby!
Szymon N. (Guest)
on 2006-03-23 19:17
In api.rubyonrails.org you have:

start_form_tag(url_for_options = {}, options = {}, *parameters_for_url)

Options:
:multipart - If set to true, the enctype is set to
"multipart/form-data".
:method - The method to use when submitting the form, usually either
"get" or "post".

So you need to specify :method as the second hash (options = {}):
start_form_tag({:controller => '', :action => '', :sth => ''}, :method
=> 'get')

That should work.
Constantin G. (Guest)
on 2006-03-23 19:27
(Received via mailing list)
Cam pe la 03/23/2006 07:17 PM, szymek scrise:
> So you need to specify :method as the second hash (options = {}):
> start_form_tag({:controller => '', :action => '', :sth => ''}, :method
> => 'get')
>

Thanks. I tried that too, but I wasn't using (). I'm still not that
familiar with ruby.

form_tag ({:controller => 'territory', :action => 'add'}, {:method =>
'get'})

--
They say money can't buy happiness? Look at the smile on my face... ear
to ear, baby!
This topic is locked and can not be replied to.