A likely problem, and one that I ran into on a Rails 4 project, is that the jQuery is not functional until the page is loaded once and then refreshed. This is because turbolinks often breaks javscript libraries such as jQuery. Many library devs are wising up to this and fixing these breaks. However, for now we have to work around these issues. In the case of jQuery the fix is straight forward.
- Add this to your Gemfile:
- In your application.js, add this after your jQuery requires and before your turbolink require. For example:
... //= require jquery //= require jquery_ujs //= require bootstrap //= require jquery.turbolinks //= require turbolinks ...
- Restart your application server and you should now have properly functioning jQuery.