In the first Rails Recipes book by Chad Fowler, there's a recipe called Connecting to Multiple Databases. I seem to remember using something like it circa 2006, but can;t lay my hands on the code (it was in a private repo of a company that was eventually bought out).
Just a little snippet from the recipe to give some clues: class External < ActiveRecord::Base self.abstract_class = true establish_connection :products end class Product < External end class TaxConversion < External end On 29 July 2012 11:28, Michael Pearson <[email protected]> wrote: > Hi, > > Lincoln Stoll recently gave a presentation about the 12 Factor App at > DevOps Melbourne. One of the take-homes from that presentation for me was > the idea of using URIs in environment variables to configure > environment-specific (vs app specific) parts of the application: > http://www.12factor.net/config > > For instance, it'd be nice if I could have on my system: > > DATABASE_URI=mysql://foo:bar@localhost/myDatabase > > And then keep application specific database config (eg, my locale) to the > database.yml. > > I'm wondering if anybody has implemented this already in a gem, or a gist, > or similar. It's relatively trivial to use ERB to do this in your > database.yml right now, but seems inelegant. > > Also, I hate ERB. Just putting that out there. > > -- > Michael Pearson > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby or Rails Oceania" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rails-oceania?hl=en. > -- *Mark Ratjens* *Co-founder, Habanero Software* * * Sydney, Australia [email protected] @MarkRatjens <[email protected]> www.habanerohq.com <http://habanerohq.com> +61 414 159 357 -- You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en.
