Setting up a Nested Form in Rails
In this lesson, we are going to integrate our views to set up a nested form in a Ruby on Rails application.
Guide Tasks
  • Read Tutorial
  • Watch Guide Video
Video locked
This video is viewable to users with a Bottega Bootcamp license

In this lesson, we are going to integrate our views to set up a nested form. If you go to the views folder, you can see that our tasks folder is at the root, so we have to move it projects so that all the tasks are inside projects if you didn't do that in the last lesson.

Next, I'm going to create a partial inside the tasks folder, and call it _form.html.erb. This partial will be accessible to the create and edit tasks.

This is the code that needs to go inside this file:

large

The first part of the code (from lines 2 to 8) is a pretty standard code to handle errors during validations, and lines from 10 to 22 contain the actual form.
We will see more about saving values from these forms in the next lesson.