Putting it all TogetherLink to heading


Below is the full todo list example demonstrating all the usual CRUD operations and how to rerender from the client-side.

Collapse file tree Expand file tree
  • app
    • components
      • todo_item_component.html.erb
      • todo_item_component.rb
      • todo_item_component.ts
      • todo_list_component.html.erb
      • todo_list_component.rb
    • config
      • routes.rb
    • controllers
      • todo_items_controller.rb
      • todo_lists_controller.rb
    • models
      • todo_item.rb
      • todo_list.rb
    • views
      • todo_items
        • create.turbo_stream.erb
        • destroy.turbo_stream.erb
        • update.turbo_stream.erb
      • todo_lists
        • show.html.erb
1
class TodoListsController < ApplicationController
2
  def show
3
    @todo_list = TodoList
4
      .includes(:todo_items)
5
      .find(params[:id])
6
  end
7
end
1
class TodoListsController < ApplicationController
2
  def show
3
    @todo_list = TodoList
4
      .includes(:todo_items)
5
      .find(params[:id])
6
  end
7
end