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:
- Retrieve the
link
for which the comment is being created (link_id
). - Create a new comment for the specific
link
that has been retrieved. - Upon submission of comment, redirect the user back to the
show
view of the link/links/1
rather than/links/1/comments
(rendershow
view for link).
Note: The redirection should be handled under the
@comment.save
conditional (line 31) , insideformat.html
(line 32).
Implementation
Get hands-on with 1400+ tech skills courses.