0
0
Ruby on Railsframework~5 mins

Environment configuration files in Ruby on Rails - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
Aconfig/environments/development.rb
Bconfig/environments/production.rb
Cconfig/application.rb
Dconfig/database.yml
What does Rails use to determine the current environment?
Aconfig/environment.rb file
Bconfig/routes.rb
CGemfile
DRAILS_ENV environment variable
Where should you put settings that apply to all environments in a Rails app?
Aconfig/application.rb
Bconfig/environments/test.rb
Cconfig/environments/production.rb
Dconfig/secrets.yml
Why avoid putting passwords directly in environment config files?
APasswords must be in the database only
BRails does not support passwords in config files
CThey might be exposed in version control
DIt slows down the app
If RAILS_ENV is not set, which environment does Rails use by default?
Adevelopment
Btest
Cproduction
Dstaging
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.