Removing Turbolinks from a Ruby on Rails 4 Project
December 11, 2013
Turbolinks was a new feature introduced in Ruby on Rails 4 that attempts to bridge the gap between server-side applications and client-side applications. It provides some interesting functionality, but can often cause more trouble than it’s worth. Luckily, it can easily be removed from a project if required.
Manual Removal
- Remove
gem 'turbolinks'
from your Gemfile and runbundle install
. - Remove
//= require turbolinks
fromapp/assets/javascripts/application.js
. - Remove both instances of
"data-turbolinks-track" => true
fromapp/views/layouts/application.html.erb
.
Slightly More Automated Removal
I’ve also created a gem called remove_turbolinks to automate this process. It provides a command to automatically handle the removal of Turbolinks for you.
- Add
gem 'remove_turbolinks'
to your Gemfile and runbundle install
. - Run
rails g remove_turbolinks:remove
to remove all references to Turbolinks in your project.
It’s as easy as that to remove Turbolinks from your Ruby on Rails project. Turbolinks is an interesting technology, so it’s worth trying before your decide to remove it.