Recall & Review
beginner
What is the purpose of environment configuration files in Rails?
They store settings that change depending on where the app runs, like development, test, or production. This helps the app behave correctly in each place.
Click to reveal answer
beginner
Name the three default Rails environment configuration files.
development.rb, test.rb, and production.rb inside the config/environments directory.
Click to reveal answer
intermediate
How does Rails decide which environment configuration file to use?
Rails uses the RAILS_ENV environment variable to pick the right config file. If not set, it defaults to development.
Click to reveal answer
intermediate
Why should sensitive data not be stored directly in environment configuration files?
Because these files can be shared or pushed to public code repositories. Instead, use environment variables or encrypted credentials.
Click to reveal answer
intermediate
What is the role of config/application.rb compared to environment config files?
config/application.rb holds settings common to all environments, while environment files hold settings specific to each environment.
Click to reveal answer
Which file would you edit to change settings only for the production environment in Rails?
✗ Incorrect
The production.rb file holds settings specific to the production environment.
What does Rails use to determine the current environment?
✗ Incorrect
Rails checks the RAILS_ENV variable to know which environment to run.
Where should you put settings that apply to all environments in a Rails app?
✗ Incorrect
config/application.rb holds shared settings for all environments.
Why avoid putting passwords directly in environment config files?
✗ Incorrect
Storing passwords in config files risks exposing them if the code is shared.
If RAILS_ENV is not set, which environment does Rails use by default?
✗ Incorrect
Rails defaults to the development environment if RAILS_ENV is missing.
Explain how Rails uses environment configuration files to manage different settings for development, test, and production.
Think about how the app changes behavior depending on where it runs.
You got /4 concepts.
Describe best practices for handling sensitive information in Rails environment configurations.
Consider what happens if your code is shared publicly.
You got /4 concepts.