I have a simple messaging app. Users can set up a public profile with their description and people can send them inquiries. Those inquiries are then collected in a table in the user dashboard.
When a user is clicking on a row, a turbo frame opens up and shows the inquiry.
I would like to implement, that the inquiry is automatically set to @inquriy.seen = true
whenever a row is clicked / the inquiry show action is called. Within the table is a blue dot in my ui that indicates, that the message/inquiry is not yet read.
currently i have this code within the show action:
respond_to do |format|
if @inquiry.update!(seen: true)
format.html
format.turbo_stream { flash.now[:notice] = "Anfrage angesehen." }
end
end
The problem is, that it does not work. The inquiry is successfully updated, but the table does not change. Instead I am getting a Completed 406 Not Acceptable
response and an ActionController::UnknownFormat
error.
I already tried to accept turbo_streams in the mime_type.rb
but there are other features in my app that are using turbo streams that work just fine (btw also in the update action of the inquiries (you can manually set them to read)).
How can I trigger the turbo_stream when clicking calling the show action to update the table in the index action?
Thanks!