I have tried given documentation for the select2-rails gem, but my browser console still throws an error.
Uncaught TypeError: $(...).select2 is not a
On rails 5 using CoffeeScript and turbolinks I had to use the line: $(document).on "turbolinks:load", -> before everything so that the code gets executed when the desired page with the select tag is loaded.
$(document).on "turbolinks:load", ->