Locations

<% @locations.each do |loc| %> <%end%>
Name Product count (ship from) Product count (ship to)
<%= loc.description %> <%= Product.where(from_location: loc).count %> <%= loc.products.count %>
<%# Put the edit link inside form just for formatting so they are one same line %> <%= form_tag([:admin, loc], method: :delete) do %> <%= link_to 'Edit', edit_admin_location_path(loc), class: "btn btn-primary btn-sm" %> <%= submit_tag("Delete", class: "btn btn-danger btn-sm") if loc.allow_destroy? %> <% end %>

<%= link_to 'Add location', new_admin_location_path, class: "btn btn-primary" %>