title: Jquery Autocomplete Gem- Passing params into database
body: <p>I'm a Rails newbie and I'm struggling to use the Jquery Autocomplete gem.  I can get the autocomplete to work fine, but I cannot pass the id of the element into my database.  No matter what, the params show the autocompleted name, thus the ID field in the database is 0.  I have the action set up in the controller as follows:</p>
  
  <pre><code>class GroupsController &lt; ApplicationController
   autocomplete :nhood, :name
  </code></pre>
  
  <p>The route also seems to work fine, since the autocomplete is functioning properly.  The error is somewhere in the form, and I have tried a ton of variations and nothing works.  The goal is to pass the neighborhood id, wich corresponds to the autocompleted neighborhood name, into a 'plans' table. Here is the form:</p>
  
  <pre><code>&lt;%= form_for(@plan, :url=&gt; groups_createplan_path) do |f| %&gt;
   &lt;div class="field"&gt;
  &lt;%= f.label :nhood_id %&gt;
  &lt;%= f.autocomplete_field :nhood_id, autocomplete_nhood_name_groups_path,
  :update_elements =&gt; {:id =&gt; '#id_element'}, :size=&gt;50 %&gt;
   &lt;%= f.submit "Submit" %&gt;
   &lt;% end %&gt;
  </code></pre>
  
  <p>I started with variations of</p>
  
  <pre><code>  :id_element =&gt; '#some_element', such as :id_element =&gt; '#nhood_id', or just
    :id_element =&gt; '#id'
  </code></pre>
  
  <p>but nothing seemed to work.  I'm pretty lost, and I think I've followed the gem documentation closely, so I don't know where the error is.  </p>
  
  <p><a href="https://github.com/crowdint/rails3-jquery-autocomplete" rel="nofollow">https://github.com/crowdint/rails3-jquery-autocomplete</a></p>
  
  <p>If someone can help, it would be much appreciated.  I'd be happy to provide more information if needed.  Thank you</p>
  
  <p>UPDATE: 
  I should also note that firebug shows the response, which includes the "id" that I want: 
      {"id":"36","label":"Soulard","value":"Soulard"}</p>
  
  <p>Hence my question is really just how do I get that "id" to pass in the params hash, instead of the "label"?  I keep getting "soulard" to pass, and not "36."    </p>