Turbo not always rendering from ApplicationController

I have a Rails app that been a few upgrades and the latest of them has added better authorization system.

The not authorized exception has handled in the ApplicationController as:

def user_not_authorized
    turbo_stream.update('flash_messages') do
      render partial: 'layouts/flash',status: :see_other, locals: { locals: { flash: flash.now[:notice] = "Action not authorized" } }

This works for some of my calls but not for this:

 <%= link_to("Copy budget to actual", transfer_budget_to_actual_project_project_job_path(@project, @project_job), class: form_button_general_style("") , method: :post, "data-turbo-stream": true) %>

I have added the “data-turbo-stream”: true just be doubly sure that it is a turbo stream that im sending from the client.

The of the interaction gives me following in my log:

dockplan-web-1  | 11:01:28 web.1  | D, [2023-12-02T11:01:28.986040 #40] DEBUG -- :   Rendered layouts/_flash.html.erb (Duration: 0.1ms | Allocations: 22)
dockplan-web-1  | 11:01:28 web.1  | I, [2023-12-02T11:01:28.986847 #40]  INFO -- : Completed 303 See Other in 33ms (Views: 0.9ms | ActiveR

So i do return a 303 for Turbo to react to, which is requirement if have understood this correctly.

Checking my browser i can see the response is correct, i do receive the correct flash message partial.

The only thing that looks odd to me is that i can see UJS is somehow mixed in to this:

Does any one have any idea to as why my link action does not update the flash message? As this is showing that it has been upgraded a few times it might just be mismatch of configuration and code between versions and ideas, I just can’t see where it is.


I figured out my issue. Just to arrive at a new one. Its rather different so it will be in different thread.