Database.yml question

Based on what I read, database.yml has the config pointing to all 3
different environment. You can use rake to move the schema from one
environment to another. How will the rails know it is running in
development or testing or data center environment to use appropriate
database ?
Thanks.

Based on what I read, database.yml has the config pointing to all 3
different environment. You can use rake to move the schema from one
environment to another. How will the rails know it is running in
development or testing or data center environment to use appropriate
database ?

I think be default at the top of config/environment.rb there is a line
that sets RAILS_ENV to development unless it’s already been set
elsewhere
in the environment.

So by default you’re gonna end up in ‘development’. Otherwise it
depends
on how you start up rails. Each web server has it’s own way of
indicating
the environment rails should start up in.

And things like script/console and script/runner take the argument on
the
command line if you want to change it.

-philip

On Jun 12, 11:43 am, Philip H. [email protected] wrote:

So by default you’re gonna end up in ‘development’. Otherwise it depends
on how you start up rails. Each web server has it’s own way of indicating
the environment rails should start up in.

And things like script/console and script/runner take the argument on the
command line if you want to change it.

-philip

Thanks for the information.