From the course: Hotwire: Reactive Ruby on Rails Applications

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Editing a task

Editing a task

- [Instructor] In this video we'll add task editing support. When clicking on one, we'll replace the name with the edit form and do the whole process in line with turbo_frames and turbo streams. The first step is to enclose its task in a turbo_frame. So open the task path shell, assign an ID to the lead tag, which will be composed of the dome_id of the task, under score li. Inside, it'll have a turbo of frame, identified by the dom_id of the task. Inside the turbo_frame, a link will show the task name pointing to the ID path. The next step is to open the edit template. We'll grab the form in a turbo_frame tag, with an ID equal to the dom_id of the task. The ID of this turbo_frame matches the ID of the path shell, so turbo will do the substitution. Let's try it. I'm going to inspect one of the tasks, and when I click on it you can see that turbo_frames replaces the link. If we analyze the request in the response…

Contents