DEV Community

Cover image for Disable Turbo on the whole application
Ken Obara
Ken Obara

Posted on • Edited on

Disable Turbo on the whole application

I am working on "The Turbo Rails Tutorial".

Problem

In Chapter 7, I can't disable Turbo on the whole application only by writing the below. For example, when I push the submit button it won't return to the homepage.

// app/javascript/application.js
import { Turbo } from "@hotwired/turbo-rails"
Turbo.session.drive = false
Enter fullscreen mode Exit fullscreen mode

Solution

The rule would be changed a bit from Turbo 7.2.x. We can add data-turbo="false" to the tag and disable Turbo.

// app/views/layouts/application.html.erb
<body data-turbo="false">
Enter fullscreen mode Exit fullscreen mode

Reference

https://github.com/hotwired/turbo/issues/826

Top comments (0)