如何使我使用脚手架生成的用户索引视图的行作为指向显示用户操作的超链接。单击用户行上的任意位置后,它将向我们显示相应的用户。
如果我可以链接到一个部门也是可以接受的。
代码
<table>
<tr>
<th>Username</th>
<th></th>
<th>email</th>
<th>roll_no</th>
</tr>
<% @users.each do |user| %>
<tr >//i want to make these rows as link
<% if user.username!='admin' %>
<td><%= user.username %></td>
<td><%= user.email %></td>
<td><%= user.roll_no %></td>
<td><%= link_to 'show', @user %></td><br/>
<td><%= link_to 'Delete', user, confirm: 'Are you sure?', method: :delete %></td>
<% end %>
</tr>