I cannot see the effect of select2 in rails 5 form whether it\'s a text_field or select. does anyone know why the tag_list is not being populated. I can see that the tag_list ha
I solved it by changing text-field to select:
<%= f.select(:tag_list, Tag.all.order(:name).collect { |a| [a.name, a.id]}, {}, id: "tag_list", label:'Tags', :multiple => true)%>
JS code is:
$(function() {
$("#tag_list" ).select2();
});
and yes, do add a file called Tag.rb in app/models. The gem only installs tables but doesn't create model.
class Tag < ApplicationRecord
validates_presence_of :name
end