<%= link_to "Show audit", audit_project_path(@project), data: { turbo_frame: "audit" }, class: "btn" %>
<%= turbo_frame_tag "audit" do %>
<p class="text-sm text-gray-500">Audit will load here.</p>
<% end %>
class ProjectsController < ApplicationController
def audit
@project = Project.find(params[:id])
@events = AuditEvent.where(record_type: 'Project', record_id: @project.id).order(id: :desc).limit(50)
render layout: false
end
end
For pages with expensive secondary data (audit trail, related entities), keep initial render fast and lazy-load a details frame only when the user asks. This is a clean performance pattern for admin pages.