我在rails上在线学习教程,但我被卡住了。这些是我的控制器和视图文件:
/app/controllers/todos_controller.rb
:
class TodosController < ApplicationController
def index
@todo_array = [ "Buy Milk", "Buy Soap", "Pay bill", "Draw Money" ]
end
end
/app/views/todos/index.html.erb
:
<title>Shared Todo App </title>
<h1>Shared Todo App</h1>
<p>All your todos here</p>
<ul>
<% @todo_array.each do |t| %>
<li> #todo item here </li>
<% end %>
</ul>
我需要更改代码#todo item here
以显示数组中的实际待办事项。所以我得到输出:
Shared Todo App
All your todos here
- Buy Milk
- Buy Soap
- Pay bill
- Draw Money