Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails: How to disable turbolinks in Rails 5?

It's a constant headache when dealing with websockets, and it kills my performance in addition to adding bugs. Since ActionCable is the whole reason I upgraded I'd very much like to get rid of it completely.

like image 801
GlyphGryph Avatar asked Jul 29 '16 02:07

GlyphGryph


2 Answers

Basically straight from here. It's for Rails 4, but I believe the steps are the same.

1) Remove the gem 'turbolinks' line from your Gemfile.

2) Remove the //= require turbolinks from your app/assets/javascripts/application.js .

3) Remove the two "data-turbolinks-track" => true hash key/value pairs from your app/views/layouts/application.html.erb .

Edit: As of at least Rails 5.0.0 the last step should refer to "data-turbolinks-track" => "reload" as opposed to "data-turbolinks-track" => true. Thanks to @boddhisattva

Edit: As of at least Rails 4.2 you can generate a project without turbolinks to begin with. Just use something like this:

rails new my_app --skip-turbolinks

like image 175
arjabbar Avatar answered Oct 19 '22 08:10

arjabbar


Removing //= require turbolinks from app/assets/javascripts/application.js seems to have done the trick.

I also removed both turbolinks references in app/views/layouts/application.html.erb

like image 38
GlyphGryph Avatar answered Oct 19 '22 08:10

GlyphGryph