I have a model subscription_tier
with show
and edit
actions with corresponding views. I've wrapped each of these with a turbo frame
<%= turbo_frame_tag subscription_tier do %>
When I edit an existing subscription tier and save it, the turbo frame refreshes and shows my saved tier, but I'm unable to replicate this for creating new tiers.
My new tier frame:
<turbo-frame id="new_tier">
<%= link_to "Add Tier", new_create_subscription_tier_path(sub_type: "Free"), class: "btn btn-primary mb-3 fs-6"
%>
</turbo-frame>
and in new.html.erb
<turbo-frame id="new_tier">
<%= render partial: "create/subscription_tiers/edit", locals: {
subscription_tier: @subscription_tier
} %>
</turbo-frame>
Clicking Add Tier button successfully renders the form and I can save the object, but on save the turbo frame is destroyed with the error Response has no matching <turbo-frame id="new_tier"> element
I know this is because my show
partial is wrapped with the <%= turbo_frame_tag subscription_tier do %>
, but I don't know how to reconcile this.