To add a Turbo Frame to application.html.erb
in Turbo-Rails, follow these steps:
Identify the section of the application.html.erb
layout where you want to add the Turbo Frame.
Add the turbo_frame_tag
helper method with the desired ID and src
URL inside that section.
Example:
<body>
<nav>...</nav>
<%= turbo_frame_tag "my_frame", src: some_path %>
<main>...</main>
<footer>...</footer>
</body>
In this example, the turbo_frame_tag
is added inside the body
section with an ID of "my_frame"
and a src
of some_path
.
application.html.erb
.Now the Turbo Frame is added to the layout and ready to use in any views that render within it.
Asked: 2022-10-04 11:00:00 +0000
Seen: 9 times
Last updated: Jan 17 '23