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
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
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.