Sudarshan Regmi
Sudarshan Regmi

Reputation: 3

How to disable Turbolinks on Heroku?

First, I removed gem 'turbolinks' and removed the code requiring Turbolinks in the application.js file. So, I successfully disabled Turbolinks in my local machine. Then, I pushed my changes to Heroku, but Turbolinks is still working in production.

How can I disable Turbolinks in Heroku?

When I ran this code:

heroku run cat app/assets/javascripts/application.js

I got following code:

//This is a manifest file that'll be compiled into application.js, which 
//will include all the files listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require jquery-ui/effects/effect-highlight
//= require bootstrap
//= require material
//= require materialize-sprockets
//= require custom
//= require cocoon
//= require underscore
//= require_tree .

Also, my Gemfile looks like this on the production environment:

source 'https://rubygems.org'

gem 'rails',                   '4.2.2'
gem 'bcrypt',                  '3.1.7'
gem 'faker',                   '1.4.2'
gem 'carrierwave',             '0.10.0'
gem 'mini_magick',             '3.8.0'
gem 'fog',                     '1.36.0'
gem 'will_paginate',           '3.0.7'
gem 'bootstrap-will_paginate', '0.0.10'
gem 'bootstrap-sass',          '3.2.0.0'
gem 'sass-rails',              '5.0.6'
gem 'uglifier',                '2.5.3'
gem 'materialize-sass'
gem 'coffee-rails',            '4.1.0'
gem 'jquery-rails',            '4.0.3'
gem 'jbuilder',                '2.2.3'
gem 'sdoc',                    '0.4.0', group: :doc
gem 'omniauth-facebook'
gem 'figaro'
gem 'material_design_lite-sass'
gem 'material_icons'
gem "font-awesome-rails"
gem 'cocoon'
gem 'simple_form'
gem 'jquery-ui-rails'
gem 'activerecord-reset-pk-sequence'
gem 'underscore-rails'
group :development, :test do
  gem 'sqlite3',     '1.3.9'
  gem 'byebug',      '3.4.0'
  gem 'web-console', '2.0.0.beta3'
  gem 'spring',      '1.1.3'
  gem "better_errors"
  gem "binding_of_caller"
end

group :production do
  gem 'pg',             '0.17.1'
  gem 'rails_12factor', '0.0.2'
  gem 'puma',           '3.1.0'
end

I have also removed all Turbolinks references in application.html.erb.

But still, Turbolinks isn't being disabled in production environment. What can be the fix?

Note: Turbolinks is successfully disabled in my development environment.

Upvotes: 0

Views: 422

Answers (2)

puneet18
puneet18

Reputation: 4427

Make "data-turbolinks-track" => false in file app/views/layouts/application.html.erb

Upvotes: 1

Kaushlendra Tomar
Kaushlendra Tomar

Reputation: 1440

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 .

Upvotes: 0

Related Questions