Using 2 database into a single RoR application

Hi everybody,

I’m trying to convert to Ror one of my old ASP classic project.

the website is an e-commerce with a community

In this website I have 2 separate database for products/BI and for user
generated content so is easyer to develop BI without touching the “user”

Pubblishing a new BI or a mayor database update is just matter of
the full BI database.

Also we can keep our development environment and staging environment on
sync with user generated content just by dropping the user database and
restoring a backup from production.

How can I make this in Ror ?


You can tell rails to use different databases on a per-model basis. Just
put a

establish_connection :dbname

in the model class, and make sure there’s a definition for ‘dbname’ in


You will need to restart the Rails application that is running in
production mode if you change the schema.

On Sep 16, 2:31 pm, “Simone R.” [email protected]