Project Challenge: Controller

Configure your comments controller's create action.

We'll cover the following

Problem statement

In this challenge, you need to configure comments_controller.rb. Edit the create action to do the following:

  1. Retrieve the link for which the comment is being created (link_id).
  2. Create a new comment for the specific link that has been retrieved.
  3. Upon submission of comment, redirect the user back to the show view of the link /links/1 rather than /links/1/comments (render show view for link).

Note: The redirection should be handled under the @comment.save conditional (line 31) , inside format.html (line 32).


Implementation

Get hands-on with 1200+ tech skills courses.