I needed a way to dynamically show and hide form options based on what a user selects and wanted to use Turbo Frames. The benefit being all of the logic can be in the erb file of what to show and hide based on the current state of the model.
This works by calling a Stimulus controller posting the unsaved form to your controller and reloading the frame the form is in. The stimulus controller adds a hidden form value to tell the controller to use mode.attrbutes = instead of update so the changes are not saved in the database and then edit action is render again and reloaded into the form frame.
I attempted to create screencast to show the method I used to do this. I would consider it a beta since it’s my first attempt at a screencast . I’m also using a similar method to add/delete items from a nested has many releationship which I will do a screencast on as well if anyone finds this first one helpful.