app/views/locations/index.html.erb
<div class="card">
<header class="card-header d-flex align-items-center">
<h3 class="mr-auto">Locations</h3>
<% if policy(:location).new? %>
<%= link_to '+ New', new_location_path, class: "btn btn-primary" %>
<% end %>
</header>
<section>
<table class="table">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
<% @locations.each do |location| %>
<tr>
<td><%= link_to location.name, location %></td>
<td align='right'>
<%= link_to 'Edit', edit_location_path(location), class: 'btn btn-primary btn-sm' %> |
<%= link_to 'Destroy', location, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger btn-sm' %>
</td>
</tr>
<% end %>
</tbody>
</table>
</section>
</div>