【发布时间】:2017-03-31 00:27:09
【问题描述】:
我不明白如何将代码插入到我的 welcome/index.html.erb 文件中。这是我的代码:
Welcome_controller.rb
def index
@welcomes = Welcome.all
end
Schedules_controller.rb
def index
@schedules = Schedule.all
end
时间表/index.html.erb
<table class="table table-hover">
<thead>
<tr>
<th>Время<br>отправления</th>
<th>Город</th>
<th>Место<br> отправления</th>
<th>Время <br>прибытия</th>
</tr>
</thead>
<tbody>
<% @schedules.each do |s| %>
<tr>
<td><%= s.deptime %></td>
<td><%= s.city %></td>
<td><%= s.street %></td>
<td><%= s.aparttime %></td>
</tr>
<% end %>
</tbody>
</table>
如何将该代码插入welcome/index.html.erb?
【问题讨论】:
标签: ruby-on-rails ruby