title: Make a Select Box that Calls a Method
body: <p>I have a rails app with working reports that have tags. In the Report/Index.html.erb I want the user to be able to sort the reports by selecting a tag. They may only select one tag at a time so I feel that a select box would work best. I currently have this:</p>
  
  <pre><code>&lt;%= select("preferences", :tag_with, 
   ["Politics", "Technology", "Entertainment", "Sports", "Science", "Crime", 
   "Business", "Social", "Nature", "Other"], :prompt =&gt; "Filter Feed by:" )%&gt;
  </code></pre>
  
  <p>I have a working preferences controller with a method call <code>tag_with</code> that updates the current tag. This code, however, only generates the select box. I want it to be that when the user selects one of the tags, it calls the tag_with method from the preferences controller.</p>
  
  <p>I generated a series of <code>link_to</code> lines that complete the task, however I would really like a select box.</p>
  
  <pre><code>&lt;%= link_to "Politics", :action =&gt; "tag_with", :tag =&gt; "Politics", :controller =&gt;"preferences" %&gt;
  &lt;%= link_to "Entertainment", :action =&gt; "tag_with", :tag =&gt; "Entertainment", :controller =&gt;"preferences" %&gt;
  &lt;%= link_to "Science", :action =&gt; "tag_with", :tag =&gt; "Science", :controller =&gt;"preferences" %&gt;
  &lt;%= link_to "Technology", :action =&gt; "tag_with", :tag =&gt; "Technology", :controller =&gt;"preferences" %&gt;
  </code></pre>
  
  <p>And so on for each tag. This works fine but is bulky and undesirable. Is there a way to do the same thing through a select box?</p>