Andy Brown
2007-Nov-13 10:28 UTC
Help please - Trying to connect to a user defined database
Hi, I''m stuck on the following problem. Using a legacy system, we have multiple databases to need to connect to. I solved this problem using the use_db plugin, as most of the information is just in two databases. However, I now need to connect to a number of databases, called by the user. I could do this by hard coding each and every database into database.yml, but this would seriously defeat DRY principles, as for these databases they are all hosted on the same host and port. I also want them all to be using a foo connection Example foo_development adapter: some_adapter database: wibble username: read_only password: xxxxx host: this_one port: 3333 foo_development adapter: some_adapter database: snark username: read_only password: xxxxx host: this_one port: 3333 foo_development adapter: some_adapter database: boom username: read_only password: xxxxx host: this_one port: 3333 I am rather stuck on trying to use ERb to only use a user defined database name, both attempting a global variable, and method defined in the base class model. Any help here would be much appreciated. Cheers Andy -- 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 -~----------~----~----~----~------~----~------~--~---