6.5. Runtime Environments

By default, Rails applications have three environments: development, test, and production. As you saw earlier, development is the default environment. These three modes are configured to act differently and in accordance with their purpose. The easiest way to understand the differences among them is to look at their configuration files located in config\environments.

6.5.1. Development

This is the code from config\environments\development.rb:

# Settings specified here will take precedence over those in config/environment.rb

# In the development environment your application's code is reloaded on
# every request.  This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.cache_classes = false

# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true

# Show full error reports and disable caching
config.action_controller.consider_all_requests_local = true
config.action_view.debug_rjs                         = true
config.action_controller.perform_caching             = false

# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false

The comments and code are pretty much self-explanatory.

In development mode the classes are not cached. This is done so that the application's code is reloaded at every request, providing an immediate feedback loop for the developer, who therefore does not need to restart the Web server for code changes (the exception ...

Get Ruby on Rails® for Microsoft Developers now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.