Challenge Solution: Comments Form
Explore how to build a comments form in Ruby on Rails using the form_with helper and nested routes. Understand how to set up the form, handle text input, and submit new comments to the associated link. This lesson helps you manage comments in your Rails application effectively.
We'll cover the following...
We'll cover the following...
Solution
//= link_tree ../images //= link_directory ../javascripts .js //= link_directory ../stylesheets .css
Explanation
app/views/links/show.html.erb
Line 15: Use form. All methods for forms are called on form.
-
Passing
[ @link, @link.comments.build ]...