title: Need a strategy for an efficient autocomplete in Rails across multiple attributes
body: <p>I have a form for submitting an order, and I need an autocomplete field that searches across three attributes in the associated customer model: first name, last name, and customer_number (as opposed to customer.id). I know about the <code>rails3-jquery-autocomplete</code> gem found here <a href="http://github.com/crowdint/rails3-jquery-autocomplete" rel="nofollow noreferrer">http://github.com/crowdint/rails3-jquery-autocomplete</a>, and got it working well, but a question has occurred to me -- is there a more efficient way to make the autocomplete work without having to query the db every time?</p>
  
  <p>The other solution that occurred to me is to create a new indexed attribute in the customer model -- call it autocomplete_data. Whenever a new customer is added via the usual new customer form, an <code>:after_create</code> callback could populate the field. Would this speed up the performance? Or am I overthinking it?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I'm embarassed to say that I just didn't search hard enough the first time around -- I think this actually answers my question:<br>
  <a href="https://stackoverflow.com/questions/6147492/rails-efficiently-searching-by-both-firstname-and-surname">Rails: Efficiently searching by both firstname and surname</a></p>