Web Development

Turbolinks is an awesome implementation in Rails. Turbolinks makes following links in your web application faster. Instead of letting the browser recompile the JavaScript and CSS between each page reload, it keeps the current page instance alive and replaces only the body (or parts of) and the title in the head.

This, however, causes some problems where javascript code isn’t reloaded.

jQuery Solution

$jQuery -> 

A quick fix is to create code like this:

ready = ->
    // do stuff
$(document).on 'ready page:load', ready

Rails Solution

The Rails solution is to disable Turbolinks.

One way is to add the following to links on the application data: { no_turbolink: true }

=link_to 'Home', root_url, data: { no_turbolink: true }

On Redirects we will need to add {turbolinks: false} to redirect_to

redirect_to root_path, turbolinks: false

Good luck!