Rails 4 TurboLinks with JQuery document ready

Using JQuery’s $(document).ready() functionality seems to be broken when using’s the Rails Gem Turbolinks. However, to fix any issues you are experiencing, add the jquery-turbolinks gem to your Gemfile

> gem ‘jquery-turbolinks’

Then, add the following line to your JS manifest file, typically application.js in your assets directory:

//= require jquery.turbolinks

After which, restart your server, and you should be good to go.

Leave a Reply

Your email address will not be published. Required fields are marked *