ruby - How do I implement database backed autocomplete fields in my rails app? -


I am looking to use an autocomplete field where users begin typing and suggested styles A list appears.

First of all, I want to prepare DB with a list of styles, then it is to be used in this autocomplete form for these people.

I'm not really looking to make the autocomplete completely, rather use the thing which is already out ... so suggestions are welcome.

I think what you want to do is put your list list of styles in seed.rb To give you so that you can list rake db: seed in your app, when you can deploy

There is an Asianist to lift you for speed:

You will end up with something like this:

  # app / model / style rb class style & lt; ActiveRecord :: Base and #bj RB ["Techno", "New Wave", "Death Metal", "Dubstep"] Do each. Style | Genre.create! (: Display_name = & gt; style) end   

Autocomplete will be easy to handle, just use this plugin, and add a generator controller that makes Jason essential.

Comments