Rails Database Configuration

I’m building an application in which I’d like groups of users to have their own dedicated MySQL/SQLite database for the application.

How can I configure Rails so that ActiveRecord uses that group’s dedicated database from the start?

Joshua Martin wrote:

I'm building an application in which I'd like groups of users to have
their
own dedicated MySQL/SQLite database for the application.

How can I configure Rails so that ActiveRecord uses that group's
dedicated
database from the start?

That question comes up fairly frequently on this list. The usual
answer: that's a bad idea -- don't do it. You shouldn't need to have
separate databases for groups.

If you can explain more about why you think you want to do this, we can
offer alternative suggestions.

--
_________________________________

Joshua S. Martin

Best,

I see. It’s not the fact that I want the data to be separated that made me consider multiple DBs, it’s the fact that I want the user to be able to make a full SQL or CSV backup of his account that can be restored from within my application or into another database.

Perhaps the better question is, how would I make an SQL or CSV export (within Rails) of only certain data in the database (the key here being only certain data) ?

Joshua Martin wrote:

I see. It's not the fact that I want the data to be separated that made
me
consider multiple DBs, it's the fact that I want the user to be able to
make
a full SQL or CSV backup of his account that can be restored from within
my
application or into another database.

Perhaps the better question is, how would I make an SQL or CSV export
(within Rails) of only certain data in the database (the key here being
only
certain data) ?

You can easily generate CSV or SQL just like any other view template.

However, for mass SQL backups, I think I'd advise just having Rails call
the database's own dump script.

Best,