user1175969
user1175969

Reputation: 570

Gem for search with autocomplete (for data from the database)

Are there any gems that help implement a search box with autocomplete? The data should come from the database.

Upvotes: 0

Views: 262

Answers (1)

Vivek Chavda
Vivek Chavda

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

Related Questions