I\'m using active_delegate for multiple connection in Rails. Here I\'m using mysql as master_database for some models,and postgresql for some other models.
Problem i
This will change the database connection for a single model object.
$config = YAML.load_file(File.join(File.dirname(__FILE__),
'../config/database.yml'))
class ModelWithDifferentConnection < ActiveRecord::Base
establish_connection $config['connection_name_from_database_yml']
end
If you are using the same server but just a different database file then you can do something like this instead.
class ModelWithDifferentConnection < ActiveRecord::Base
# Lives in the CURRICULUM database
def self.table_name
"database.table"
end
end