select2-rails gem is not working on Rails4

前端 未结 4 579
一个人的身影
一个人的身影 2021-01-02 17:55

I have tried given documentation for the select2-rails gem, but my browser console still throws an error.

Uncaught TypeError: $(...).select2 is not a

4条回答
  •  爱一瞬间的悲伤
    2021-01-02 18:38

    I had the same problem and changing the order of JS plugins didn't help.

    I ended up removing turbolinks and it's working now. Probably not the best solution but it was the best thing that I achieve after some hours searching.

    So, basicly I removed that line from application.js file:

    //= require turbolinks
    

提交回复
热议问题