CSV 上传显示故障 Rails 6

CSV upload display glitch Rails 6

所以我在控制器和模型区域中正确设置了所有内容,但在事物的视图方面遇到了一些问题。出于某种原因,它正确显示了 1-3 秒,但随着更多元素加载并弹出到我只能描述为终端视图或只是原始数组视图而不是 html/css 的内容,它有点“中断字符”它应该在里面。这是我的代码:

<table>
<thead>
    <tr>
    <th>Company Name</th>
    <th>Country</th>
    <th>Region</th>
    <th>Description</th>
    <th>Last Funding</th>
    <th>Total Funding (USD)</th>
    </tr>
</thead>
<tbody>
    <%= @data.each do |datum| %>
    <tr>
    <th><%= datum.company_name %></th>
    <th><%= datum.country_code %></th>
    <th><%= datum.region_name %></th>
    <th><%= datum.description %></th>
    <th><%= datum.last_funding_on %></th>
    <th>$<%= datum.total_funding_usd %></th>
    </tr>
    <% end %>
</tbody>

这是它在浏览器中的样子:

[#, #<数据id: 2, country_code: "中国", region_name: "上海", company_name: "WM Motor", description: "WM Motor is an automotive company that designs, ma...", last_funding_on: nil, total_funding_usd: 3073404327, created_at : "2020-10-25 17:42:39", updated_at: "2020-10-25 17:42:39">,

只需替换这一行

<%= @data.each do |datum| %>

<% @data.each do |datum| %>

因为你不想输出(<%)each方法调用的return值。你只想输出(<%=)个属性。