Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rails form_tag url path

This seems like it should be so simple but it has been causing me issues.

I have a select_tag that pulls from a model. All I want to is have a person choose their location from the drop down, press submit and take it to that places page.

Here is what I have

<% 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 it of course wants an :id but it won't pull the :id from the drop down menu below.

What am I doing wrong, any other suggestions on the "right" way to do this.

Thanks

like image 600
looloobs Avatar asked Nov 14 '10 06:11

looloobs


1 Answers

Looks like you actually want to GET, not to POST the params.

form_tag installation_path, :method => :get do
like image 84
Max Chernyak Avatar answered Sep 23 '22 01:09

Max Chernyak