小编Vip*_*til的帖子

#index 上的意外项目列表

在我的索引页面上,我成功地在一个表格中列出了我的所有“游戏”,不幸的是,另一个列表,它不是我的 index.html.erb 文件代码的一部分,也出现在我的表格上方。我不明白这是怎么可能的,因为我的 html 文件在列表出现在浏览器上的位置不包含任何元素......如果有人有一个非常好的想法!

这是浏览上显示的照片: 浏览器问题快照

这是我的 index.html.erb 代码:

<div class="container full-height">
  <div class="abs-center">
    <table class="table">
      <thead>
        <tr>
          <td colspan="6">GAMES</td>
        </tr>
      </thead>
      <tbody>
        <%= @games.reverse.each do |g| %>
          <tr>
            <td><%= g.id %></td>
            <td><%= g.score_1 %></td>
            <td><%= g.score_2 %></td>
            <td><%= g.created_at %></td>
            <td><%= link_to 'see game', game_path(g) %></td>
            <td><%= link_to 'modify', edit_game_path(g) %></td>
          </tr>
        <% end %>
      </tbody>
    </table>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

我的游戏控制器索引方法:

  def index
    @games = Game.all
  end
Run Code Online (Sandbox Code Playgroud)

非常感谢 !

html html-table ruby-on-rails

0
推荐指数
1
解决办法
42
查看次数

标签 统计

html ×1

html-table ×1

ruby-on-rails ×1