0
0
Ruby on Railsframework~10 mins

First Rails application - Interactive Code Practice

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

Complete the code to create a new Rails application named 'blog'.

Ruby on Rails
rails [1] blog
Drag options to blanks, or click blank then click option'
Anew
Bstart
Ccreate
Dinit
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'rails create' instead of 'rails new'.
Using 'rails init' which is not a valid command.
Using 'rails start' which is for running the server, not creating an app.
2fill in blank
medium

Complete the code to start the Rails server.

Ruby on Rails
bin/rails [1]
Drag options to blanks, or click blank then click option'
Aserver
Bcreate
Cstart
Drun
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'bin/rails start' which is not a valid Rails command.
Using 'bin/rails run' which does not start the server.
Using 'bin/rails create' which is for generating files.
3fill in blank
hard

Fix the error in the command to generate a controller named 'Posts'.

Ruby on Rails
bin/rails [1] controller Posts
Drag options to blanks, or click blank then click option'
Acreate
Bmake
Cbuild
Dgenerate
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'make' or 'build' which are not Rails commands.
Using 'create' which is not the correct Rails generator command.
4fill in blank
hard

Fill both blanks to define a root route to the 'index' action of 'posts' controller in config/routes.rb.

Ruby on Rails
root to: '[1]#[2]'
Drag options to blanks, or click blank then click option'
Aposts
Bindex
Chome
Dshow
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'home#index' instead of 'posts#index'.
Using 'posts#show' which shows a single post, not the index.
Swapping the controller and action names.
5fill in blank
hard

Fill all three blanks to create a migration that adds a 'title' string column to the 'posts' table.

Ruby on Rails
bin/rails [1] migration Add[2]To[3]
Drag options to blanks, or click blank then click option'
Agenerate
BTitle
CPosts
Dcreate
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'create' instead of 'generate' for the first blank.
Swapping 'Posts' and 'Title' in the migration name.
Using lowercase for the migration name parts.