ruby on rails - undefined method `todo_items' for #<TodoList:0x4528c20> -
i getting error
undefined method `todo_items' #<todolist:0x4528c20>
in code:
<h1><%= @todo_list.title %></h1> <p>find me in app/views/todo_items/index.html.erb</p> <ul class="todo_items"> <% @todo_list.todo_items.each |todo_item| %> <li><%= todo_item.content %></li> <% end %> </ul>
i new rails, unsure how debug error or where possible issue. can guide me on equivalent of console.log
or var_dump
in rails.
update:
todo_items_controller.rb
class todoitemscontroller < applicationcontroller def index @todo_list = todolist.find(params[:todo_list_id]) end end
it looks missing has_many association in todolist class.
has_many :todo_items
assuming have todoitem class associated db table
Comments
Post a Comment