Forum: Ruby on Rails (nebie) Autocomplete and many to one relationship?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Greg F. (Guest)
on 2006-05-23 00:56
(Received via mailing list)

I'm trying to get autocomplete to work for the first time.

I'm not sure if I'm doing this right or not.

I have a table where one of the fields is a employees name.  I expect a
relatively small collection of person's names will be used.

I created a simple employees table with just 2 fields: id, and name.

Then in my main table I added a employee_id field and setup the
/ has_many: entries in the models of each.

In my _form.rhtml I have the autocomplete line that is working:
<%= text_field_with_auto_complete :employee, :name %>

ie. If I start typing, I get a pull-down like entry populated from my
employees table.

The trouble is with the save at the end.  Nothing is getting saved to
my employees table in the situation a new employee name is typed, and
not to
my main table.

First, is this supposed to work?

If so, do I have to add code to the update method for my main
None of the examples I've looked discuss doing so.

This topic is locked and can not be replied to.