Database.yml question


#1

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.


#2

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


#3

On Jun 12, 11:43 am, Philip H. removed_email_address@domain.invalid 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.