| 1 | <h2>Full example</h2> |
| 2 | <pre><code><%# index.erb %> |
| 3 | <h1>Listing Books</h1> |
| 4 | <table> |
| 5 | <tr> |
| 6 | <th>Title</th> |
| 7 | <th>Summary</th> |
| 8 | <th></th> |
| 9 | <th></th> |
| 10 | <th></th> |
| 11 | </tr> |
| 12 | |
| 13 | <% @books.each do |book| %> |
| 14 | <tr> |
| 15 | <td><%= book.title %></td> |
| 16 | <td><%= book.content %></td> |
| 17 | <td><%= link_to "Show", book %></td> |
| 18 | <td><%= link_to "Edit", edit_book_path(book) %></td> |
| 19 | <td><%= link_to "Remove", book, method: :delete, data: { confirm: "Are you sure?" } %></td> |
| 20 | </tr> |
| 21 | <% end %> |
| 22 | </table></code></pre> |