I'm starting using rails for a project where the SQLite database to use
depend on the SERVER_NAME contacted during the request. As I can't use
database.yml because the dbfile is dynamic, I declare my ActiveRecords
objects in application.rb and I establish_connection manually. But now
that I saw the screencast about migration, I know that I'll need this
because when I'll have to add a field in my database objects, I'll have
to do it to a bunch of SQLite databases with important data inside.
So my question is : what is the clean RoR way to use more than one
database and one of them should be dynamically selected with the
I've got another question : as a fcgi process can serve more than one
request, I would like to know if Rails keep the connection to the
database for all the requests or if it opens and closes the
connection(s) at each request. If it keeps the connection, how can I
make Rails close connections for each request ? Not sure if it's
relevant for SQLite.