Challenge - 5 Problems
Rails Config Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate1:30remaining
Purpose of the config folder in Rails
What is the main purpose of the
config folder in a Rails application?Attempts:
2 left
💡 Hint
Think about where Rails keeps files that control app settings and environment.
✗ Incorrect
The
config folder contains files like database.yml, environment settings, and initializers that configure how the Rails app runs.❓ component_behavior
intermediate1:30remaining
Effect of changing config/environments/production.rb
If you modify
config/environments/production.rb in a Rails app, what will happen when you deploy to production?Attempts:
2 left
💡 Hint
Each environment file controls settings for that specific environment.
✗ Incorrect
The
production.rb file holds configuration specific to the production environment, so changes here affect production behavior.📝 Syntax
advanced2:00remaining
Correct syntax for database config in config/database.yml
Which option shows the correct YAML syntax for defining the default database adapter as PostgreSQL in
config/database.yml?Attempts:
2 left
💡 Hint
YAML uses indentation and colons for key-value pairs.
✗ Incorrect
YAML requires a colon and indentation for nested keys. Option C correctly shows this format.
🔧 Debug
advanced2:00remaining
Why does Rails ignore changes in config/initializers?
You changed a file in
config/initializers but your Rails app does not reflect the change after reload. Why?Attempts:
2 left
💡 Hint
Think about when initializers run in the Rails lifecycle.
✗ Incorrect
Initializers run once when the Rails server boots. Changes require a server restart to reload.
❓ state_output
expert2:30remaining
Output of Rails config after modifying config/application.rb
Given this snippet in
config/application.rb:
module MyApp
class Application < Rails::Application
config.time_zone = 'Eastern Time (US & Canada)'
end
end
What will Rails.application.config.time_zone return at runtime?Attempts:
2 left
💡 Hint
The
config.time_zone setting sets the app's time zone.✗ Incorrect
Setting
config.time_zone in application.rb changes the default time zone accessible via Rails.application.config.time_zone.