Hi everyone, I''m quite new to RoR but in general wanna try get some of my holes within Ruby on Rails plugged. At the moment my biggest question is: How can you as elegantly as the standard database config use multiple database sources. For instance if you got a project database in a MsSQL database, economy data from a Oracle database to get data to fill in a new database schema in your own control. (I''m a fool for elegant solutions instead of spaghetti solutions). I seen myriads of howtos and more about database pooling and more, but cant for the life of me find anything about this subject. And for the time being most of my projects have multiple data sources to mine data from, and I''m eager to try get a new project up running on RoR to get some more hands on knowledge instead of making hobbyist projects all the time :D Thank you in advance! -- 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 -~----------~----~----~----~------~----~------~--~---
> How can you as elegantly as the standard database config use multiple > database sources.Seems as I posted this I found the solution within the hour :D class SomeTable < ActiveRecord::Base establish_connection :<some database alias from database.yml> end Enjoy ;) -- 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 -~----------~----~----~----~------~----~------~--~---
You can have a separate DB for each model? Cheers, SAzima On Feb 9, 8:59 am, Klaus Myrseth <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > How can you as elegantly as the standard database config use multiple > > database sources. > > Seems as I posted this I found the solution within the hour :D > > class SomeTable < ActiveRecord::Base > establish_connection :<some database alias from database.yml> > end > > Enjoy ;) > -- > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I too am trying to do this. It seems like something that should be easily configurable. establish_connection :blah seems to work fine in the model, however causes problems in the migration used to create that model ActiveRecord::Base.establish_connection :blah The migration completes successfully but then an exception is thrown: rake aborted! An error has occurred, this and all later migrations canceled: not connected Tasks: TOP => db:migrate -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.