Rails acts-as-taggable-on with select2 (and simple_form)

后端 未结 3 1397
梦毁少年i
梦毁少年i 2021-01-05 09:18

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

3条回答
  •  清酒与你
    2021-01-05 09:48

    Try this one, hope this will work for you.

    = f.input :tag_list, class: "taggable",data: {options: @model.tags.map { |t| t.name }} 
    
    $(".taggable").select2(
      tags: $('.taggable').data('options')
      width: "252px"
    );
    

提交回复
热议问题