Rails: How to disable turbolinks in Rails 5?

后端 未结 5 1923
谎友^
谎友^ 2020-12-04 17:45

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 mu

5条回答
  •  甜味超标
    2020-12-04 18:00

    If you are using Webpacker (Rails 5-6)

    • Delete this line from Gemfile and run bundle:

    gem 'turbolinks', '~> 5'

    • Run yarn remove turbolinks

    • Delete this line from application pack file app/javascript/packs/application.js:

      require("turbolinks").start()

    • Remove any data-turbolinks data attributes from your html.

    Change:

    <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
    <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
    

    to

    <%= stylesheet_link_tag 'application', media: 'all' %>
    <%= javascript_pack_tag 'application' %>
    

提交回复
热议问题