Reputation: 570
Are there any gems that help implement a search box with autocomplete? The data should come from the database.
Upvotes: 0
Views: 262
Reputation: 473
I had a lot of fun creating something similar using select2: https://select2.github.io/
You can set up an ajax call: https://select2.github.io/examples.html#data-ajax
So the search is done on the back end (regular sql query, or however you're handling it), the results are sent to the front, which can display a drop down list (and I believe it would select the first result by default, which is essentially autocomplete).
Upvotes: 1