Complete the code to generate the path for the home page using a named route helper.
root_path = [1]home_path if not defined.The root_path helper generates the path for the root route defined in Rails routes.
Complete the code to generate the path for showing a user with id 5 using a named route helper.
user_show_path = user_[1]_path(5)
edit or new which are for different actions.index which lists all users.The user_show_path is not a standard Rails helper. The correct helper is user_path(5) for showing a user. But since the blank is inside the helper name, the correct part is show to complete user_show_path.
Fix the error in the code to generate the edit path for a post with id 10.
edit_post_[1](10)
edit_post_url when only path is needed.edit_post_link which is not a helper.The correct helper for editing a post is edit_post_path(10). Using url or others will cause errors or unexpected output.
Fill both blanks to generate the path for deleting a comment with id 7.
delete_[1]_[2](7)
post instead of comment for the resource.url when path is expected.The correct helper for deleting a comment is delete_comment_path(7). This generates the path for the delete action on the comment resource.
Fill all three blanks to generate the path for creating a new article.
[1]_[2]_[3]
edit instead of new.articles.The helper for the new article form is new_article_path. This helper generates the path to the form for creating a new article.