ChaelCodes/HuntersKeepers

View on GitHub
app/views/hunter_backstories/index.html.erb

Summary

Maintainability
Test Coverage
<p id="notice"><%= notice %></p>

<h1>Hunter Backstories</h1>

<table class="table">
  <thead>
    <tr>
      <th>Backstory</th>
      <th>Hunter</th>
      <th>Playbook</th>
      <th colspan="2"></th>
    </tr>
  </thead>

  <tbody>
    <% @hunter_backstories.each do |hunter_backstory| %>
      <tr>
        <td><%= link_to hunter_backstory_name(hunter_backstory), hunter_backstory %></td>
        <td><%= link_to hunter_backstory.hunter, hunter_backstory.hunter %></td>
        <td><%= link_to hunter_backstory.playbook, hunter_backstory.playbook %></td>
        <td>
          <% if policy(hunter_backstory).edit? %>
            <%= link_to 'Edit', edit_hunter_backstory_path(hunter_backstory) %>
          <% end %>
        </td>
        <td>
        <% if policy(hunter_backstory).destroy? %>
          <%= link_to 'Destroy', hunter_backstory, method: :delete, data: { confirm: 'Are you sure?' } %>
        <% end %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>