All threads / Rails 6 autocomplete with add new

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Rails 6 autocomplete with add new

Alex Deering asked in Rails

In the past (back in rails 4) I used select2 or selectize to give me the ability to make a text field autocomplete as typed and have the option to create a new item, so basically tagging but only a single tag allowed. I recently got back into working on a project and upgrading to rails 6. Im new to stimulus and webpacker and wondering if there is a way to handle autocomplete with the option to create new for a field. Ive looked for some information already but couldnt find anything.

For context it has to do with a recipe database and for the ingredients of the recipes they have 3 fields (amount, unit, ingredient_id). Im wanting to have the ingredient_id field be a text field with autocomplete/add new that will reference my ingredient table so I can add data to the ingredients

Did you ever find a solution for this Alex? I'm very new to stimulus and I would love to know how to do autocomplete with it too :)

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 33,665+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.