I would like to have a select2 dropdown of tags, where i could select multiple existing tags and add new ones.
I have tried many different ways and i either don\'t g
For me work this:
Coffee script:
$( ".tags" ).select2
theme: "bootstrap",
tags: true
tokenSeparators: [',']
and in the view:
= f.input :tag_list, input_html: { class: 'tags', multiple: "multiple" }, collection: @video.tag_list
Important part is multiple: "multiple"
And of course, how Mitja said, don't forget to put { tag_list: [] } to your controller strong parameters.
And as example, if you want to have your tags as suggestions in the dropdown, you could do this:
= f.input :tag_list, input_html: { class: 'tags', multiple: "multiple" }, collection: ActsAsTaggableOn::Tag.most_used(30), value_method: :name