Demystifying Turbo Frames

Turbo frame can be tricky.

The following serves as a reference, mainly for myself:

<-- index.html.erb -->

<%= turbo_frame_tag "modal" do %>
  <h1> modal</h1>
<% end %>

<--  outside a frame -->
<%= link_to("message", message_path, "data-turbo-frame":"modal") %>


<-- message.html.erb -->
  <%= turbo_frame_tag "modal" do %>
    the contents of this message will replace the h1 tags in the above page.
  <% end %>

Written on February 19, 2021