Multiple databases and fixtures problems

I’m working on a Rails app which makes use of two distinct (i.e. not
master-slave) databases, one ours and the other a central data store
which holds the core data we’re using.

We have two sets of model classes, and the central store’s models are
in a plugin and are namespaced (more than one project use them). So,
we have classes like:

CentralStore::ModelName < ActiveRecord::Base

for the central store, and

ModelName < ActiveRecord::Base

for ours. Our first big problem was with fixtures for the namespaced
models. I shimmed the ActiveRecord fixtures mechanism so you could
pass a block with the connection to the db you wanted the fixtures
created in and the right thing would be done:

class TestClass < Test::Unit::TestCase
fixtures(:model_one, :model_two) {CentralStore::Base.connection}

That’s only mapping .yml files to DB table names though: The big
problem is that ActiveRecord’s fixture helper methods look for class
names corresponding to table names (derived from the .yml files),
which means that no namespaced models will be found (table name ==
‘model_name’, class == ‘CentralStore::ModelName’).

The easy solution is to simply include the module in your
test_helper.rb. However, that leaves you open to the thing that bit me
today: if your central store’s models gain a class with the same name
as one of yours (or vice versa).

Of course, the models are namespaced, so in application code there
isn’t a problem. However, in tests, the models clash (you get a
superclass mismatch error and your tests just don’t run…) and you
can’t have fixtures for both tables.

My short term solution is to rename the local model, but has anyone
run into the same issue and done something elegant about it? I don’t
want to rewrite the fixtures stack only to discover that someone else
has a less intrusive solution…

Thanks,

Matt