I’m brand new to ROR so sorry for the noob question. Been searching the
net
for this one but haven’t been able to figure it out.
My ROR application talks to an existing database. Yup I figured out how
to
make ActiveRecord work with tables that already exist and don’t play to
the
naming convention of rails, all good there.
What makes my existing situation tricky is that my server has a number
of
copies of the same database but I need to access one of those databases
based on the URL
On Monday, 12 May 2014 19:40:10 UTC-4, Bastiaan O. wrote:
copies of the same database but I need to access one of those databases
2) how do I then use this name in database.yml ?
If there’s really a fixed set of DBs to choose from, the simplest
alternative would be to provision each subdomain as a separate copy of
the
application with different environment variables. For instance, in an
Apache / Passenger stack you could use SetEnv in each vhost’s
configuration
to pass a different DATABASE_URL.
Hassan, I’ll be sure to check out those leads. It would be viable to
have
to add new entries into database.yml whenever we put a new site online
and
switching between them but it would be preferably to create the pools
for a
specific database when it is first used (with maybe a way to clean up)
Matt, with a separate copy of the application, do you mean duplicating
my
rails app for each database/subdomain combo I have or would just having
different vhosts setup? I can imagine once my rails app loads it would
create the session pool for that database requiring the duplication of
the
app but I would rather avoid that.