Skip to content

Instantly share code, notes, and snippets.

@nakaearth
Created June 29, 2014 22:17
Show Gist options
  • Save nakaearth/0ea0988de9d251319e6d to your computer and use it in GitHub Desktop.
Save nakaearth/0ea0988de9d251319e6d to your computer and use it in GitHub Desktop.
draperを使った場合のapp/views/users/index.html.erb
<h1>Listing users</h1>
<table>
<thead>
<tr>
<th>Name</th>
<th>Age</th>
<th>Description</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @users.each do |user| %>
<tr>
<td><%= user.name %>(<%= user.short_name %>)</td>
<td><%= user.age %></td>
<td><%= user.description %></td>
<td><%= link_to 'Show', user %></td>
<td><%= link_to 'Edit', edit_user_path(user) %></td>
<td><%= link_to 'Destroy', user, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
<br>
<%= link_to 'New User', new_user_path %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment