Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Rhys Park
Rhys Park
8,311 Points

Ajax in Form Create or Edit With Auto Complete

Hi am trying to create a form that either adds a record or updates it depending on if it is completed or not.

I have a form that uses the autocomplete gem for rails and what I need to do is to display the existing record if it is incomplete

So far I have it creating a record without problem Autocomplete has the following method

    $('#my_autocomplete_field').bind('railsAutocomplete.select', function(event, data){
      /* Do something here */

How do i use this, to display an incomplete record like

   If Ticket.find_by_fist(#inputboxdata)