Most likely similar questions have been asked, but weirdly I can't find it using those keywords...
Let's say you have a model Actor
with a field :name
. Now somewhere else there is a model Movie
which has_many :actors
. I'm trying to make a form where I can dynamically add some actors to a movie.
Using angularJS I would have used typeahead:
<input type="text" ng-model="actor_selected" placeholder="Add actor to movie"
typeahead="actor as actor.name for actor in actors">
Which basically shows and autocompletes by actor name, but internally saves the actor_id in $scope.actor_selected
How can i do that using rails-autocomplete plugin in an .erb file? The following isn't working/doing what I want :
<%= f.autocomplete_field :actor_id, movies_autocomplete_actor_name_path, class: "form-control" %>