title: Creating a simple drop-down menu in Rails
body: <p>This really seems simple enough yet for some reason I'm missing something critical. </p>
  
  <p>I have a view:</p>
  
  <pre><code>&lt;% form_for :foo, @foo, :url =&gt; {:action =&gt; 'bar'} do |f|%&gt; 
    &lt;%= f.collection_select :range, FooModel::MONTHS%&gt;
    &lt;%= submit_tag "Submit", :disable_with =&gt; "Submitting..." %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>I have a model:</p>
  
  <pre><code>class FooModel &lt; ActiveRecord::Base
    MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep']
  end
  </code></pre>
  
  <p>And I have a controller:</p>
  
  <pre><code>def new
    @foo = FooModel.new
  end
  
  def index
    respond_to do |format|
      format.html # index.html.erb
    end
  end
  
  def bar
    if params[:foo]
      @foos = params[:foo].inspect
    end
  
    respond_to do |format|
      format.html # index.html.erb
    end
  end
  </code></pre>
  
  <p>My question is, how do I get at the information as to which combo box element had been selected when the Submit button was clicked? It doesn't seem to be params[:foo], @foo, or anything else I can think of.</p>
  
  <p><strong>Update</strong>
  Looking at it it seems like I should maybe be calling params[:range]? That, however, is nil.</p>