学习如何为数据制作表格

时间:2016-03-14 14:56:11

标签: html ruby-on-rails html-table

我正在制作一个包含电话号码,订阅布尔值和群组的表格。我当前的表没有像它应该的那样排列传入日期。我相信这是一个简单的HTML问题,但无论出于何种原因,我都无法提出解决方案。这是一些代码和我正在使用的屏幕截图。

  <tbody>
    <tr>
      <% @people.each do |person| %>
        <th><%= person.phone_number %></th>
      <% end %>
      <% @people.each do |person| %>
        <th><%= person.subscribed %></th>
      <% end %>
    </tr>
  </tbody>

enter image description here

您可以看到它没有列出,只是在屏幕上内嵌。

1 个答案:

答案 0 :(得分:1)

试试这个:

<tbody>
 <% @people.each do |person| %>
     <tr>

        <th><%= person.phone_number %></th>


        <th><%= person.subscribed %></th>
        <th><%= person.group %></th>

    </tr>
 <% end %>
</tbody>