LemonMan
LemonMan

Reputation: 3143

Setting Rails Environment Locally

Currently, the rails environment for my local machine and the development stack are the same (development)

I'd like to have certain error handling notifications go out when people get an error on the development server, but not locally.
To do this, I'd like to set the rails env on people's local machines to local or something like that.

How would that work?

Upvotes: 1

Views: 643

Answers (1)

joelparkerhenderson
joelparkerhenderson

Reputation: 35453

Rails has three default environments: DEVELOPMENT, TEST, PRODUCTION.

You can create your own environment, which is a good solution for what you're asking.

You can choose your own environment name, create your own environment settings, etc.:

To do this, create an environment file:

  • config/environments/foo.rb

And you'll likely want to add a database connection by editing this file:

  • config/database.yml

I suggest not using the name LOCAL because it's a misnomer.

Some teams choose explicit names, such as DEVELOPMENT_WITH_ERROR_NOTIFICATIONS.

Some teams choose to keep DEVELOPMENT for the typical local developer machines, because this matches the typical Rails documentation; the teams name the development server environment something meaningful such as QA, DEMO, ALPHA, INTEGRATION, etc.

Upvotes: 1

Related Questions