In general, Rails gets its environment from the shell variable RAILS_ENV at startup or defaults to "development". You can specify the environment for the rails command, for example rails server
, rails console
(Rails 3), script/server
or script/console
(Rails 2.x) from the bash command line, as shown below:
RAILS_ENV=something rails s
This means that for the rails s
variable, the value "something" is assigned to the variable RAILS_ENV
.
source share