I installed select2-rails and act_as_taggable_on gem to my app. I setup the act_as_taggable_on and it works (I tested from the console). However, when I tried to create the view
It's working now. I did it with this code: https://stackoverflow.com/a/33035355/5081949
Here is my code now:
app/views/profiles/new.html.erb
<%= f.input :skill_list, input_html: { class: 'multiple-input', multiple: "multiple" }, collection: @profile.skill_list %>
app/assets/application.js
$(document).ready(function() {
$('.multiple-input').each(function() {
$(this).select2({
tags: true,
tokenSeparators: [','],
theme: 'bootstrap',
placeholder: 'Separated by comma'
});
});
});
also in apps/controllers/profiles_controller.rb I added strong params
def profile_params
params.require(:profile).permit(:name, skill_list: [])
end