0
0
Ruby on Railsframework~10 mins

Named routes and path helpers in Ruby on Rails - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to generate the path for the home page using a named route helper.

Ruby on Rails
root_path = [1]
Drag options to blanks, or click blank then click option'
Ahome_path
Broot_path
Cindex_path
Dmain_path
Attempts:
3 left
💡 Hint
Common Mistakes
Using a route helper that does not exist like home_path if not defined.
Confusing URL helpers with path helpers.
2fill in blank
medium

Complete the code to generate the path for showing a user with id 5 using a named route helper.

Ruby on Rails
user_show_path = user_[1]_path(5)
Drag options to blanks, or click blank then click option'
Aindex
Bnew
Cedit
Dshow
Attempts:
3 left
💡 Hint
Common Mistakes
Using edit or new which are for different actions.
Using index which lists all users.
3fill in blank
hard

Fix the error in the code to generate the edit path for a post with id 10.

Ruby on Rails
edit_post_[1](10)
Drag options to blanks, or click blank then click option'
Apath
Burl
Clink
Droute
Attempts:
3 left
💡 Hint
Common Mistakes
Using edit_post_url when only path is needed.
Using edit_post_link which is not a helper.
4fill in blank
hard

Fill both blanks to generate the path for deleting a comment with id 7.

Ruby on Rails
delete_[1]_[2](7)
Drag options to blanks, or click blank then click option'
Acomment
Bpost
Cpath
Durl
Attempts:
3 left
💡 Hint
Common Mistakes
Using post instead of comment for the resource.
Using url when path is expected.
5fill in blank
hard

Fill all three blanks to generate the path for creating a new article.

Ruby on Rails
[1]_[2]_[3]
Drag options to blanks, or click blank then click option'
Anew
Barticle
Cpath
Dedit
Attempts:
3 left
💡 Hint
Common Mistakes
Using edit instead of new.
Using plural resource names like articles.