【发布时间】:2012-10-30 06:15:46
【问题描述】:
这是我的代码,我想在其中显示从图书表中获取的图书详细信息。
<div class="tab-pane" id="computer"> <!-- Branch Computer -->
<legend> Computer Science</legend>
<table class ="table table-hover">
<thead>
<tr>
<th> S.No </th>
<th> Book Name </th>
<th> Year </th>
<th> User ID</th>
<th> Owner Address</th>
</tr>
</thead>
<tbody>
<% @books.each do |b| %>
<tr>
<% if b.branch == "Computer Science"%>
<td><%= b.id%></td>
<td><%= b.book_name%></td>
<td><%= b.year%></td>
<td><%= b.user_id%></td>
<!-- For displaying user details -->
<% @susers.each do |s|%>
<% if s.user_id == b.user_id %>
<td><%= s.address %></td>
<%else%>
<td><%"Not found"%></td>
<%end%>
<%end%>
<%else%>
<td><%"No any book of this branch"%></td>
<%end%>
</tr>
<%end%>
</tbody>
</table>
</div><!-- End of Computer Branch-->
但我不知道这里的输出出了什么问题?
它是这样显示的。注意每一行的长线。 编辑后我得到了这么多。
好的,这是终端中发生的异常情况
【问题讨论】:
-
您是否可以发布您的 CSS,假设您正在谈论的问题是您的桌子上出现的疯狂线条我相信问题出在 CSS 中。带有类 table 和 tablehover 以及它们的子定义 (td,th,tr,tbody's)
-
实际上所有的类都是 twitter bootstrap 的。他们刚刚提到在需要时使用这些类。
-
第 31 行需要 > 和 > 或将它们放在 if/else 之外(查看 @SachinParasad 的帖子后)
-
请您准确告诉我需要编辑的内容。因为第 31 行是 td 标签。