Disable turbolinks in Rails

1. Common events (reloading cures)

・ When you jump to a page, only that page keeps shaking. -No transition even if submit of form_for / with is pressed. -The slider images are arranged in an array.

2. Turbolinks need to be disabled

rails:views/layout/application.html.erb



<div 
 <% if content_for?(:body_attributes) %>  
   <%= yield(:body_attributes) %>
 <% end %>
>
 <%= yield %>
</div>

Without closing the closing brace of the div <% if content_for?(:body_attributes) %> <%= yield(:body_attributes) %> Put <% end%> inside

Insert the following code at the top of the view page you want to disable

<% content_for(:body_attributes) do %>
      data-turbolinks="false"
  <% end %>

If you want to disable the turbolinks of the link destination, in link_to

You can disable it by adding , data: {"turbolinks "=> false}.

When you want to disable with a href

<div data-turbolinks='false'>
    <a href="/"></a>
</div>

3. At the end

How easy it is to do it! !! I still have to study! !!

Recommended Posts

Disable turbolinks in Rails
[Rails] How to disable turbolinks
Remove "assets" and "turbolinks" in "Rails6".
Group_by in Rails
Model association in Rails
Adding columns in Rails
CSRF measures in Rails
Disable IPv6 in CentOS8
^, $ in Rails regular expression
Use images in Rails
Understand migration in rails
Split routes.rb in Rails6
Implement markdown in Rails
Get UserAgent in [Rails] controller
Implement application function in Rails
Declarative transaction in Rails #ginzarb
Implement follow function in Rails
Japaneseize using i18n with Rails
Implement LTI authentication in Rails
Error in rails db: migrate
Gem often used in Rails
Display Flash messages in Rails
View monthly calendar in Rails
Implement import process in Rails
Use multiple checkboxes in Rails6!
Disable static initializer in PowerMock
Rewrite Routes in Rails Engine
Rails: Capture regular expressions in emails!
[Rails] Keyword search in multiple tables
[Rails] Session timeout setting in devise
Add a search function in Rails.
[rails] Login screen implementation in devise
[Rails] How to write in Japanese
About the symbol <%%> in Rails erb
[Rails] Use cookies in API mode
Implement simple login function in Rails
Create a new app in Rails
Ruby on Rails Japanese-English support i18n
[Solution] Webpacker :: Manifest :: MissingEntryError in Rails
Disable display when not logged in
Implement a contact form in Rails
CRUD features and MVC in Rails
How to introduce jQuery in Rails 6
First pagination feature added in rails
Data is not registered in Rails.
[Rails 6] Customize Bootstrap in Rails + Bootstrap 5.0.0-alpha environment
Implement CSV download function in Rails
Ruby methods often used in Rails
How to install Swiper in Rails
How to implement search functionality in Rails
Definitions other than 7 basic actions in Rails
[Rails] Function restrictions in devise (login / logout)
How to change app name in rails
How to use custom helpers in rails
How to insert a video in Rails
The identity of params [: id] in rails
[rails] List of actions defined in Controller
Rails refactoring story learned in the field
Ruby on Rails in Visual Studio Codespaces
JavaScript (vanilla) does not respond in Rails.
How to use MySQL in Rails tutorial