Kta-M/minimum_crud

View on GitHub
lib/generators/templates/views/without_sub_layout/index.html.erb

Summary

Maintainability
Test Coverage
<h1><%%= "Listing #{@model.to_s.pluralize}" %></h1>

<p id="notice"><%%= notice %></p>

<table>
  <thead>
    <tr>
<% @attributes.each do |attribute| -%>
      <th><%= attribute.humanize %></th>
<% end -%>
      <th colspan="3"></th>
    </tr>
  </thead>

  <tbody>
    <%% @records.each do |record| %>
      <tr>
<% @attributes.each do |attribute| -%>
        <td><%%= record.<%= attribute %> %></td>
<% end -%>
        <td><%%= link_to 'Show', url_for(action: :show, id: record) %></td>
        <td><%%= link_to 'Edit', url_for(action: :edit, id: record) %></td>
        <td><%%= link_to 'Destroy', url_for(action: :destroy, id: record), method: :delete, data: { confirm: 'Are you sure?' } %></td>
      </tr>
    <%% end %>
  </tbody>
</table>

<br>

<%%= link_to "New #{@model.to_s}", url_for(action: :new) %>