4

i noted that in rails 2.3.2 there is no more option to set which rails environment you are using. So i cannot just set it anymore in environment.rb? There is any other way to set it?

6 Answers 6

3

RAILS_ENV=production rake db:migrate

What exactly are you trying to run? The rails generator? A rake task? Mongrel? I'm not sure this is actually a Rails issue.

Disclaimer: I haven't used 2.3.2, however.

Sign up to request clarification or add additional context in comments.

Comments

1

Maybe you mean in config/environment.rb?

I'm 90% sure you can just add the line there if you need it. And I'm wrong, see VP's comment below. (Tested and confirmed it)

1 Comment

90% sure? its not allowed anymore.. to be honest the server ignore it. You must pass it as a argument to the server
1

im using rails 2.3.5 which should be similar to 2.3.2, and terry lorber is right,

RAILS_ENV=xyz is the exact way to lauch rails stuff with RAILS_ENV specifified from command line.

In this way, you can use rake, script/console script/runner script/server etc. in your different environments

Comments

0

I think it's a command line argument.

1 Comment

THIS ANSWER IS INCORRECT!!! It is an ENVIRONMENT variable which you can set in your shell: RAILS_ENV -- see Terry's answer
0

define in config/environments/production.rb or development.rb or whatever other modes you are running like stage.rb instead of writing/defining in config/environment.rb

I am using it and its serving my purpose. don't use the keyword RAILS_ENV (I haven't tried it) I am using it APP_MODE = "Production" In production environment file and APP_MODE = "Development" in development file.

then you can use this in your application to detect which mode you are in.

Hope, I answer the question

Comments

0

If you wanna run an application in development,

ruby script/server

To run in production,

ruby script/server -e production

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.