2

select2 を使用している配列がありますが、同じ値を複数回選択したいと考えています。この機能を有効にする方法はありますか? 私のコードは以下の通りです:

#home.js
$(document).ready(function(){ 
    $("#productdropdown").select2({
        allowClear: true,
        placeholder: "Select a product..."
    });
});

それから私の見解では

#index.html.erb
<%= form_tag manuals_path, method: :post, remote: true do %>
    <%= form_tag manuals_path, method: :post, remote: true do %>
    <%= select_tag :device, options_from_collection_for_select(@products, :id, :full_name), id: "productdropdown", multiple: true %>
    <%= submit_tag 'CREATE MYMANUAL', class: 'submit', id: "generate" %>
<% end %>

そしてコントローラーで

  def index
    @products = Product.usable
  end
4

0 に答える 0