【发布时间】:2015-09-25 13:31:22
【问题描述】:
我尝试为我的索引视图呈现的 HTML 表发生了一些奇怪的事情。以下是我的看法:
<div class="container-fluid" style="margin-top:51px">
<h1>Assets</h1
<table id="indexTable" class="table table-hover">
<thead>
<tr>
<th>Uploaded Files</th>
</tr>
</thead>
<tbody>
<% @assets.each do |asset| %>
<tr>
<td><%= link_to asset.uploaded_file_file_name, asset.uploaded_file.url %></td>
<td><%= link_to "Show", asset %></td>
<td><%= link_to "Edit", edit_asset_path(asset) %></td>
<td><%= link_to "Destroy", asset, :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</tbody>
</table>
<p><%= link_to "New Asset", new_asset_path %></p>
</div>
我的问题是没有这样的表格呈现。相反,我得到了这个烂摊子:
<div class="container-fluid" style="margin-top:51px">
<h1>Assets</h1>
Uploaded Files
<a href="/uploaded_files/original/missing.png">/uploaded_files/original/missing.png</a>
<a href="/assets/1">Show</a>
<a href="/assets/1/edit">Edit</a>
<a rel="nofollow" href="/assets/1" data-method="delete" confirm="Are you sure?">Destroy</a>
<a href="/uploaded_files/original/missing.png">/uploaded_files/original/missing.png</a>
<a href="/assets/2">Show</a>
<a href="/assets/2/edit">Edit</a>
<a rel="nofollow" href="/assets/2" data-method="delete" confirm="Are you sure?">Destroy</a>
<a href="/system/assets/uploaded_files/000/000/003/original/500SO.png?1443185486">500SO.png</a>
<a href="/assets/3">Show</a>
<a href="/assets/3/edit">Edit</a>
<a rel="nofollow" href="/assets/3" data-method="delete" confirm="Are you sure?">Destroy</a>
</div>
这并不是网站上其他任何地方的问题;我到处都有桌子,渲染得非常好。我知道我不会给你太多的工作,但这几乎就是我所拥有的。有什么想法吗?
【问题讨论】:
-
你错过了 H1 的收盘价>
-
您将什么发送回浏览器......希望它的 index.html.erb 并注意您的 html 视图中使用的所有标签
标签: html ruby-on-rails ruby-on-rails-4 erb