Multiple databases

I am using Rails 1.2.2 that needs to access multiple databases having
the same schema. I understand the establish_connection mechanism to
overwrite the default ActiveRecord::Base database conneciton. That
seems to gear toward different databases for different model. But in
my case, the model is the same but there are more than one database.
The preferred end result is to display data from mutiple databases for
the same model or have different page for data from different
database. Either way, I need to be able to “tell” (or pass) my model
to use different database. That is, I like to pass the database
connection setting to my model from the controller.

I would think that model is the modeling of database tables and that
the physical database connection could be orthogonal to the the model
and not tied up with model itself.

Any help will be highly appreciated.

[email protected] wrote:

I am using Rails 1.2.2 that needs to access multiple databases having
the same schema. I understand the establish_connection mechanism to
overwrite the default ActiveRecord::Base database conneciton. That
seems to gear toward different databases for different model. But in
my case, the model is the same but there are more than one database.
The preferred end result is to display data from mutiple databases for
the same model or have different page for data from different
database. Either way, I need to be able to “tell” (or pass) my model
to use different database. That is, I like to pass the database
connection setting to my model from the controller.

I would think that model is the modeling of database tables and that
the physical database connection could be orthogonal to the the model
and not tied up with model itself.

Any help will be highly appreciated.

Please refer
http://wiki.rubyonrails.org/rails/pages/HowtoUseMultipleDatabases