Jason Hale
2006-Mar-19 03:47 UTC
[Rails] Oracle connection problems when connecting to multiple databases
I have a rails application that connects to two different databases. The first (primary) database is MySQL and the second is Oracle. I have followed the example in the Rails Recipes book and I have created a base class for the models connecting to oracle like this: class ConferenceBase < ActiveRecord::Base establish_connection :conference end :conference is setup in the database.yml. A model subclass can now connect to my Oracle database -- a little too well. Every time I do anything with a subclass of this model it establishes a NEW connection. Does anyone know how to do this so a new connection to Oracle is created everytime you access the model? -Jason