Forum: Ruby on Rails How to pass additional get parameters using button_to?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Dennis T. (Guest)
on 2009-03-05 19:32
(Received via mailing list)
A google search only turned up a few posts with the same problem, but
no answer...


<%= button_to("New user", new_user_path(:testvar1 =>
"test1", :testvar2 => "test2"), :method => :get) %>


<form method="get" action="/users/new?
testvar1=test1&amp;testvar2=test2" class="button-to"><div><input
type="submit" value="New user" /></div></form>

Which doesn't work as browsers strip the get parameters off the uri.
Shouldn't the button_to-helper generate the get parameters as hidden
tags when using :method => :get?

Like this?

<form method="get" action="/users/new" class="button-to"><div><input
type="submit" value="New user" /></div><input type="hidden"
name="testvar1" value="test1"><input type="hidden" name="testvar2"

Is this possible or are there another solution when using button_to?
This topic is locked and can not be replied to.