How to show page loading between pages

From Turbolinks, something like?

$(document).on('page:fetch', function() {
  // show spinner
});

$(document).on('page:change', function() {
  // hide spinner
});

Update for Turbolinks 5

For Turbolinks 5:

$document.on('turbolinks:click', function() {
  // show spinner
});

$document.on('turbolinks:load', function() {
  // hide spinner
});

If you are using jQuery and your spinner is in the div.spinner, you can show and hide it with:

$(document).on("turbolinks:click", function(){
  $(".spinner").show();
});

$(document).on("turbolinks:load", function(){
  $(".spinner").hide();
});

Rails uses turbolinks by default.

Please take a look at turbolinks and how it works. It basically replace the body of the page instead of making a new request, that's why you don't see the loading indication in the browser.

If you want to see your page loading you can either disable turbolinks, removing it from application.js, or use a gem like this one: https://github.com/caarlos0/nprogress-rails to show the actual loading of the page.

I strongly suggest you to keep turbolinks and go with the second option I gave you.