↖️ Show all posts

Turbolinks is misunderstood

Take a lunch break and watch this beautiful talk about why Turbolinks is good for you. And how you can build a hybrid app with less than 50 lines of code with it.

So please, look up their documentation, it is very good

Unbreak your jQuery document.ready:

I guess this can’t be repeated often enough :-)

To unbreak your jQuery code in an rails app with Turbolinks simply change your faulty document.ready functions:

// this does not work with Turbolinks
$(document).ready(function() {
  // do something  
});
// BUT THIS DOES WORK:
$(document).on('turbolinks:load', function() {
  // do something
});

and for your Coffeescript + Turbolinks use this:

$(document).on 'turbolinks:load', ->

⬅️ Read previous Read next ➡️