Description
Steps to reproduce
Alas, there is no clear, reliable way to reproduce the problem, aside from accessing the entire application.
What is occurring is that a number of form_with
forms are invariably reverting to processing via HTML only, as if some switch was thrown at some point. However this is not consistent across the application. It appears to be constrained to a single specific class.
Actual behavior
Following are examples of form_with and different uses with the HTML rendering and the returned logs for the two actions (and two actions only) that require turbo stream responses for this class.
<%= form_with(model: @parti) do |form| %>
<form action="/partis" accept-charset="UTF-8" method="post"><input type="hidden" name="authenticity_token" value="[...]" autocomplete="off">
Started POST "/partis" for ::1 at 2024-05-11 11:33:08 +0200
Processing by PartisController#create as HTML
<%= form_with(model: @parti, local: false) do |form| %>
<form action="/partis" accept-charset="UTF-8" data-remote="true" method="post"><input type="hidden" name="authenticity_token" value="[...]" autocomplete="off">
Started POST "/partis" for ::1 at 2024-05-11 11:40:50 +0200
Processing by PartisController#create as HTML
Rendering partis/create.html.erb within layouts/parti
<%= form_with(url: update_consumer_partis_url, data: { remote: true }) do |form| %>
<form data-remote="true" action="/partis/create_consumers" accept-charset="UTF-8" method="post"><input type="hidden" name="authenticity_token" value="[...]" autocomplete="off">
Started POST "/partis/update_consumer" for ::1 at 2024-05-11 12:03:49 +0200
Processing by PartisController#update_consumer as HTML
Parameters: {"authenticity_token"=>"[FILTERED]", "name"=>"Abc", "consumer_id"=>"1", "id"=>"150", "commit"=>"confirm"}
whereas other classes seem to process by TURBO_STREAM as expected. not been fully determined (many actions have yet to be checked)
Started PATCH "/shopcategoryminors/update_translations" for 127.0.0.1 at 2024-05-11 12:10:42 +0200
Processing by ShopcategoryminorsController#update_translations as TURBO_STREAM
update further testing: movign the controller action to a different controller and the processing is, as expected, processing as TURBO_STREAM
.
How can one debug the process from Started POST
to Processing by ...Controller#update_consumer as HTML
and determine where the process veers off course? or what should one be looking for?
Expected behavior
as the default behaviour is to default to turbo_stream, that is the expectation.
System configuration
ruby "3.3.0"
gem "rails", "~> 7.1.3", ">= 7.1.3.2"