Project Challenge: Partials

Tidy up your "show" view by using partials.

Problem statement

In this challenge, you have to create a form partial for your comments to declutter the links/show.html.erb file.

Important concepts

  1. Partials contain blocks of code that can be used in different parts of the application without needing to rewrite the code.
  2. For a form partial in your CRUD application, you created a new file called app/views/pets/_form.html.erb.
  3. This partial could be rendered in any of the other views by using <%= render 'form' %>.
  4. Since you want to render a comments partial for a links view, you will use render 'comments/form'. Rails will figure out that you mean to render _form.html.erb in the app/views/comments directory.


Get hands-on with 1200+ tech skills courses.