Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turbolinks for Rails not active

I am trying to get Turbolinks to work with my Rails 3.2 app, but without success. I am still getting full page reloads in Chrome and Firefox when I click on links.

  1. I have included the turbolinks gem in the Gemfile, and required it in the application.js file.
  2. I should add that I run Twitter Bootstrap 2.2.1.1, and that all non-bootstrap/rails javascript is disabled.

In Chrome developer tools I can see that turbolinks.js is loaded, together with all other files. Any suggestions on why turbolinks is not active in my app?

like image 728
graphmeter Avatar asked Nov 04 '22 10:11

graphmeter


1 Answers

If you are using a bootstrap template, then the javascript (by default) is not placed in the <head> element of your page.

I was able to reproduce the issue w/ Rails 3.2.11, turbolinks 1.0 and a default bootstrap template as my application layout

If you move <%= javascript_include_tag "application" %> from the bottom of the layout (usually just above </body> to somewhere within the <head> element, then everything should start working.

a.

like image 100
Angry Badger Avatar answered Nov 12 '22 18:11

Angry Badger