Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

documentation for environments #432

Merged
merged 1 commit into from

2 participants

@tjeden

I've added documentation for environments (#410). Is it what you were thinking of?

@rkh rkh merged commit b92087a into sinatra:master
@rkh
Owner

Thanks a ton.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 20, 2011
  1. enviroments description added to Readme

    Aleksander Dąbrowski authored
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 0 deletions.
  1. +12 −0 README.rdoc
View
12 README.rdoc
@@ -1386,6 +1386,18 @@ You can also hand in an array in order to disable a list of protections:
[views] Path to the views folder. Inferred from <tt>app_file</tt>
setting if not set.
+== Environments
+
+There are three predefined +environments+: <tt>development</tt>, <tt>production</tt> and <tt>test</tt>. Environment can be set by RACK_ENV environment variable, and default value is <tt>development</tt>.
+
+You can also run different environemnt using <tt>-e</tt> option:
+
+ ruby my_app.rb -e [ENVIRONMENT]
+
+You can use predefinied methods: +development?+, +test?+ and +production?+, to check which enviroment is set.
+
++Developemnt+ is default setting. In this mode, all templates are being reloaded between requests. Special <tt>not_found</tt> and <tt>error</tt> handlers are installed for this enviroment, so you will see nice error page. In +production+ and +test+ templates are being cached.
+
== Error Handling
Error handlers run within the same context as routes and before filters, which
Something went wrong with that request. Please try again.