Ruby on Rails come with three environments by default – development, testing and production. But sooner or later one has a need for staging environment. And don’t get me wrong, you can (or should?) use the production settings there, but if you run it locally or on the same server as production, chances are you need a different database. And while you are at it, it may be handy to allow logging to console or change any other of Rails settings for that matter. In fact you can create as many other environments as you want and since it’s really easy I encourage you to do so.
To create a new environment you need to create:
config/environments/YOUR_ENVIRONMENT.rb
fileconfig/database.yml
if your application uses databaseconfig/secrets.yml
for apps on Rails 4.1 and higher