<%= render 'admin/headers/index', records: @menus, model_name: 'Menu' %>

<div class="table-responsive">
  <table class="forest-table table table-striped">
    <thead>
      <tr>
        <th>Title</th>
        <th>Slug</th>
        <th>Structure</th>
        <th colspan="3"></th>
      </tr>
    </thead>

    <tbody>
      <% @menus.each do |menu| %>
        <tr>
          <td><%= menu.title %></td>
          <td><%= menu.slug %></td>
          <td><%= render 'shared/menu', menu: Menu.for(menu.slug) %></td>
          <td width="1"><%= link_to 'Edit', edit_admin_menu_path(menu), class: 'btn btn-xs btn-primary', role: 'button' %></td>
          <td width="1"><%= link_to 'Show', [:admin, menu], class: 'btn btn-xs btn-info', role: 'button' %></td>
          <td width="1"><%= link_to 'Destroy', [:admin, menu], method: :delete, class: 'btn btn-xs btn-danger', role: 'button', data: { confirm: 'Are you sure?' } %></td>
        </tr>
      <% end %>
    </tbody>
  </table>
</div>

<%= paginate @menus %>

<%= render 'admin/headers/index', records: @menus, model_name: 'Menu' %>

<div class="table-responsive">
  <table class="forest-table table table-striped">
    <thead>
      <tr>
        <th>Title</th>
        <th>Slug</th>
        <th>Structure</th>
        <th colspan="3"></th>
      </tr>
    </thead>

    <tbody>
      <% @menus.each do |menu| %>
        <tr>
          <td><%= menu.title %></td>
          <td><%= menu.slug %></td>
          <td><%= Menu.for(menu.slug).render %></td>
          <td width="1"><%= link_to 'Edit', edit_admin_menu_path(menu), class: 'btn btn-xs btn-primary', role: 'button' %></td>
          <td width="1"><%= link_to 'Show', [:admin, menu], class: 'btn btn-xs btn-info', role: 'button' %></td>
          <td width="1"><%= link_to 'Destroy', [:admin, menu], method: :delete, class: 'btn btn-xs btn-danger', role: 'button', data: { confirm: 'Are you sure?' } %></td>
        </tr>
      <% end %>
    </tbody>
  </table>
</div>

<%= paginate @menus %>

Optimize N+1 query in menus index
Optimize N+1 query in menus index
