title: Getting rails3-autocomplete-jquery gem to work nicely with Simple_Form with multiple inputs
body: <p>So I am trying to implement multiple autocomplete using <a href="https://github.com/crowdint/rails3-jquery-autocomplete/" rel="nofollow">this gem</a> and simple_form and am getting an error.</p>
  
  <p>I tried this:</p>
  
  <pre><code>&lt;%= f.input_field :neighborhood_id, collection: Neighborhood.order(:name), :url =&gt; autocomplete_neighborhood_name_searches_path, :as =&gt; :autocomplete, 'data-delimiter' =&gt; ',', :multiple =&gt; true, :class =&gt; "span8" %&gt;
  </code></pre>
  
  <p>This is the error I get:</p>
  
  <pre><code>undefined method `to_i' for ["Alley Park, Madison"]:Array
  </code></pre>
  
  <p>In my params, it is sending this in <code>neighborhood_id</code>:</p>
  
  <pre><code>"search"=&gt;{"neighborhood_id"=&gt;["Alley Park, Madison"],
  </code></pre>
  
  <p>So it isn't even using the IDs for those values.</p>
  
  <p>Does anyone have any ideas?</p>
  
  <p><strong>Edit 1:</strong></p>
  
  <p>In response to @jvnill's question, I am not explicitly doing anything with <code>params[:search]</code> in the controller. A search creates a new record, and is searching <code>listings</code>.</p>
  
  <p>In my Searches Controller, <code>create</code> action, I am simply doing this:</p>
  
  <pre><code>@search = Search.create!(params[:search])
  </code></pre>
  
  <p>Then my <code>search.rb</code> (i.e. search model) has this:</p>
  
  <pre><code>def listings
      @listings ||= find_listings
  end
  
  private
    def find_listings
      key = "%#{keywords}%"
      listings = Listing.order(:headline)
      listings = listings.includes(:neighborhood).where("listings.headline like ? or neighborhoods.name like ?", key, key) if keywords.present?
      listings = listings.where(neighborhood_id: neighborhood_id) if neighborhood_id.present?
      #truncated for brevity
      listings
    end
  </code></pre>