【发布时间】:2020-09-17 22:26:39
【问题描述】:
所以在我的网站上,有一个不需要的文本节点,其中包含我的数据库记录。 html代码上没有任何标签或元素,但不知何故它存在。
我估计是这行代码造成的:
<%= @workspace.items.each do |item| %>
<tr>
<td><%= item.name %></td>
<td><%= item.owner %></td>
<td><%= item.quantity %></td>
<td><%= item.details %></td>
<td><%= link_to 'Edit Item', edit_workspace_item_path(@workspace,item) %></td>
<td><%= link_to 'Delete', [item.workspace, item],
method: :delete,
data: { confirm: 'Are you sure?' } %></td>
</tr>
view.html.erb:
<p>
<strong>Name:</strong>
<%= @workspace.name %>
</p>
<p>
<strong>maxitem:</strong>
<%= @workspace.max %>
</p>
<p>
<strong>details:</strong>
<%= @workspace.details %>
</p>
<p>
<%= link_to 'Edit Phase', edit_workspace_path(@workspace) %>
</p>
<p><strong>Items</strong>
</p>
<p>
<%= link_to 'Add Item', new_workspace_item_path(@workspace) %></br>
</p>
<table>
<tr>
<tr>
<th><strong>Name</strong>
<th><strong>Owner</strong>
<th><strong>Quantity</strong>
<th><strong>Details</strong>
</tr>
<%= render 'items/item' %>
</table>
<%= link_to 'Back to List of Phases', workspaces_path %>
我不知道为什么这突然出现在我的网站上 like this
【问题讨论】:
标签: html ruby-on-rails ruby database