0
0
Ruby on Railsframework~10 mins

Root route 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 set the root route to the home controller's index action.

Ruby on Rails
root to: '[1]'
Drag options to blanks, or click blank then click option'
A"index#home"
B"home#index"
C"home#index_path"
D"root#index"
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping controller and action names.
Adding extra suffixes like _path.
Using incorrect quotes or missing quotes.
2fill in blank
medium

Complete the code to define the root route using the to: syntax.

Ruby on Rails
root [1] 'home#index'
Drag options to blanks, or click blank then click option'
Ato:
Bpath:
Croute:
Dcontroller:
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'path:' or 'route:' which are invalid keys here.
Omitting the colon after 'to'.
3fill in blank
hard

Fix the error in the root route definition.

Ruby on Rails
root '[1]'
Drag options to blanks, or click blank then click option'
Ahome#index
Bindex#home
Chome#index_path
Droot#index
Attempts:
3 left
💡 Hint
Common Mistakes
Adding '_path' to the action name.
Swapping controller and action names.
4fill in blank
hard

Fill both blanks to define a root route that points to the welcome controller's show action.

Ruby on Rails
root to: '[1]#[2]'
Drag options to blanks, or click blank then click option'
Awelcome
Bshow
Cindex
Dhome
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping controller and action names.
Using incorrect controller or action names.
5fill in blank
hard

Fill all three blanks to define a root route using the to: syntax that renders the dashboard controller's main action.

Ruby on Rails
root [1] '[2]#[3]'
Drag options to blanks, or click blank then click option'
Ato:
Bdashboard
Cmain
Dhome
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong keys like 'path:' or 'route:'.
Swapping controller and action names.