Link to delete and turbo drive disabled

I’v got turbo disabled app wide:

   import '@hotwired/turbo-rails'
   Turbo.session.drive = false

because I want to apply it gradually for now by adding ‘data-turbo’: true where necessary. All goes smooth except one thing. Despite adding ‘data-turbo’: true to link_to … method: :delete request is still processed as html not turbo-stream. I’v found it works as expected when I change it to button_to. Is there any way to use link though ?

I use @hotwired/turbo-rails": “^7.1.1”

ps: adding ‘data-turbo-method’: ‘DELETE’ also does not solve it Release v7.0.0-beta.6 · hotwired/turbo · GitHub

Does your controller action respond to stream requests, i.e format.turbo_stream { #something }. Or having a resource/delete.turbo_stream.erb ?

Yep, I’v got

    respond_to do |format|
        format.turbo_stream do
            ....

And all works as expected unless I disable turbo app wide and want to enable here.

I’v found what was wrong, I still had method: :delete in link params, there should be only ‘turbo-method’: ‘DELETE’ in data

3 Likes