Ruby on rails 为什么渲染部分集合不起作用?

Ruby on rails 为什么渲染部分集合不起作用?,ruby-on-rails,Ruby On Rails,这是我的密码: 在我的index.erb上 <tbody> <tr> <th>Company</th> </tr> <% render partial: :company, collection: @companies %> </tbody> 单位 在my_company.erb上: <tr> <td><%= link_to co

这是我的密码: 在我的index.erb上

<tbody>
    <tr>
        <th>Company</th>
    </tr>
    <% render partial: :company, collection: @companies %>
</tbody>

单位
在my_company.erb上:

<tr>
    <td><%= link_to company.name, company %></td>
</tr>

它不会在视图上显示数据。

您需要更改

<% render partial: :company, collection: @companies %>



您缺少一个
=

它显示空白页?是的,没有错误,数据不会显示。
<%= render partial: :company, collection: @companies %>