Environments

  1. There are three predefined environments: development , production and test .

  2. Environments can be set through the RACK_ENV environment variable.

  3. The default value is development
  4. In the development environment all templates are reloaded between requests, and special not_found and error handlers display stack traces in your browser
  5. In the production and test environments, templates are cached by default
  6. To run different environments, set the RACK_ENV environment variable:

    RACK_ENV=production ruby my_app.rb
    
  7. You can use predefined methods: development?, test? and production? to check the current environment setting:

    get '/' do
      if settings.development?
        "development!"
      else
        "not development!"
      end
    end
    

Casiano Rodriguez León 2015-01-07