Rails form_tag url

It seems to be so simple, but it was causing me problems.

I have a select_tag that pulls from a model. All I want is for a person to choose their location from the drop-down list, click "Submit" and go to this page.

That's what i

<% form_tag installation_path do %> <%= select_tag :id, options_from_collection_for_select(Installation.find(:all), :id, :name) %> <div id="button"> <p> <%= submit_tag "Go", :name => nil %> </p> </div> 

The problem is that she, of course, wants :id , but does not get :id from the drop-down menu below.

What am I doing wrong, any other suggestions on the β€œright” way to do this.

thanks

+6
ruby-on-rails forms
source share
1 answer

It sounds like you really want to GET, not POST params.

 form_tag installation_path, :method => :get do 
+5
source share

All Articles