justin100-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Feb-22 16:55 UTC
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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
justin100-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org 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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---