How can one switch environment in Rails 3?
Rails ships with a default configuration for the three most common environments that all applications need: test, development, and production.
Use command ENV in rails console. That will return a hash of your environmental values you can access. Alternatively, you can access your environmental variables from your apps root path using the same command and the variables will be returned formatted.
Use the environment flag:
rails s --environment=production
Or set the RAILS_ENV
environment variable.
If you want to save keystrokes:
rails s -e production
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With