So I have been working on getting this Twitter Bootstrap typeahead to work and right now I can get a list of all my data when I start typing it into the form, but when I submit, the values do not get passed in as IDs. Is there any way for me to pass in an id number based on the autocomplete selection?
Here’s the code I’m using…
<%= f.text_field :cargo_to_load_id, :data => { provide: "typeahead", source: Cargo.order(:name).map(&:name) , items: "9" } %>
Turns out that I need to have these getter and setter methods in my model file. These will then do the work of finding the corresponding id.