0
0
Ruby on Railsframework~20 mins

Rails installation and setup - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Rails Setup Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate
2:00remaining
Correct command to create a new Rails app with PostgreSQL
Which command correctly creates a new Rails application named blog using PostgreSQL as the database?
Arails create blog -d postgresql
Brails new blog -db postgresql
Crails new blog --database=mysql
Drails new blog -d postgresql
Attempts:
2 left
💡 Hint
Use the rails new command with the correct database option.
component_behavior
intermediate
2:00remaining
Behavior of rails server command
What happens when you run the command rails server in a Rails project directory?
AStarts a local web server running the Rails app on port 3000 by default
BCompiles the Rails app into a standalone executable
CDeletes temporary files and caches in the project
DGenerates a new controller with default actions
Attempts:
2 left
💡 Hint
Think about what a server command usually does.
🔧 Debug
advanced
2:00remaining
Error when running rails db:create
You run rails db:create but get the error: could not connect to server: Connection refused. What is the most likely cause?
AThe <code>rails db:create</code> command is deprecated and should not be used
BThe Rails app has syntax errors in <code>database.yml</code>
CThe database server (e.g., PostgreSQL) is not running or not installed
DThe Rails version is incompatible with the database adapter
Attempts:
2 left
💡 Hint
Check if your database service is active.
🧠 Conceptual
advanced
2:00remaining
Purpose of the Gemfile in Rails setup
What is the main purpose of the Gemfile in a Rails project?
ATo list and manage Ruby gems (libraries) the project depends on
BTo configure database connection settings
CTo define routes for the Rails application
DTo store environment variables for deployment
Attempts:
2 left
💡 Hint
Think about how Ruby projects manage external libraries.
state_output
expert
2:00remaining
Result of running rails new without Ruby installed
What will happen if you try to run rails new myapp on a system where Ruby is not installed?
AThe command will create a minimal app with only JavaScript files
BThe command will fail with an error like 'rails: command not found' or similar
CRails will download and install Ruby automatically before creating the app
DThe app will be created but will not run until Ruby is installed
Attempts:
2 left
💡 Hint
Rails depends on Ruby to run commands.