Do we need official Rails 7 guides for integrating with turbo to counter stackoverflow cruft?

Rails 7, turbo, frames, streams and stimulus went through a rapid evolution over the last couple of years and there are many search engine indexed discussions describing bugs, solutions and patterns that no longer apply. (At least, I think they don’t apply.) The only official documentation on turbo in the Rails 7 guide is under “working with javascript” and doesn’t really give guidance on Rails-turbo patterns.

The only thing we have that specifically references turbo links to the framework-agnostic documentation on Turbo, and this is under “working with javascript”:

I think at this point, we wouldn’t expect others to search in “working with javascript.” The whole assembled glory of Rails 7 hotwired is to hide the javascript except where you want a stimulus sprinkle. People should expect to see turbo patterns like :see_other and :unprocessable_entity in the Rails 7 guides for layouts and rendering, controllers, and form helpers. (I know you don’t have to use turbo, but if you want to take advantage of it, those are the places you’re looking for guidance.)

I think the major sticking point I see in stackoverflow and Rails github issues is form submits and feeding server-side validation errors back to the client. I think we need to briefly define a Rails pattern for

if @object.valid?
   redirect_to path, status: :see_other
  render 'view', status: :unprocessable_entity

I can’t write this myself because after all the time I’ve spent implementing turbo, I’m not even sure that’s right. I still find myself surprised by an unexpected GET resulting in a 200 stomping my nice 422 and blasting my model errors. Sometimes I’m using a turbo_frame_tag because that’s the only way I can get it to work, but other times I can make the form work without it. Should we have official guide content on turbo patterns?


Case in point where I and others have questions, but I probably don’t have valid answers, would like help from someone more knowledgeable to update the documentation a little for things like this: