Forum: Ruby on Rails database.yml question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
9eb3f9018980d0ad0feae770b2971d8b?d=identicon&s=25 DBC User (Guest)
on 2007-06-12 17:21
(Received via mailing list)
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.
2f9a03aa0fcfe945229cb6126eda2cb2?d=identicon&s=25 Philip Hallstrom (Guest)
on 2007-06-12 18:37
(Received via mailing list)
> 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
9eb3f9018980d0ad0feae770b2971d8b?d=identicon&s=25 DBC User (Guest)
on 2007-06-12 20:40
(Received via mailing list)
On Jun 12, 11:43 am, Philip Hallstrom <r...@philip.pjkh.com> 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.
This topic is locked and can not be replied to.