Two kinds of environment
A line left open on purpose
The Rails CLI: rails new course's config lesson named three files in passing: "config/environments/development.rb, test.rb and production.rb each override application.rb for one environment." Then it added: "Environment: dev vs test covers this split later." This is that course.
"Environment" already means something else
The Development environment courses (macOS, Linux and Windows (WSL2)) spent their lessons on a computer. They covered a code editor, a Ruby version manager, PostgreSQL and Git, everything a person installs before writing Rails. That's a correct use of the word, a computer's environment. It's not what this course means.
What Rails means by environment
Two developers can have different setups, say one on macOS and one on Linux through WSL2. They can still run the same Rails app in the same one of three named modes: development, test or production. That mode, tracked by Rails.env, is what "environment" means in this course. A laptop's setup and Rails' environment are separate axes. A developer switches Rails' environment many times a day without touching the laptop's setup.
Why name the confusion now
Both phrases share the words "development environment". Reading them and thinking "reinstall my toolchain" instead of "the mode Rails is running in" is an easy mistake. Naming it here keeps it out of the rest of the course.
What this course covers
Rails.env, theRAILS_ENVvariable, and the three modes Rails understands.development.rbvstest.rb, line by line.production.rb, and what changes once real users are involved.database.yml, and how one file sends each environment to its own databases.- Switching environments, and how that relates to the Rails console (IRB) course's sandbox mode.
- A wrap-up, and what comes next.
By the end, Rails.env is a mode you can name, switch and reason about.
Keep going with lesson 2
Rails.env: three named modes, one variable
Shows Rails.env as an EnvironmentInquirer, how RAILS_ENV sets it, and the three modes with their config files.
A free account also gives you the quizzes, your progress and notes, and the discussion.