I think the gist of this fix is great, just a few comments:
* You should probably hold the objects, not the ids in the class arrays.
* You could use after_saves to do the storing
* You could encapsulate the 'get a random one of these' with Foo.random
Cool. I will look at cleaning that up and attach a new patch to the
Other than that it looks good. Tests relying on the ids is a bit of a smell.
Thanks, and yes, that's what I thought.
Out of interest, why do you need to change that setting?
My development environment matches the production environment for one
of my clients. On that system, I'm running a BackgrounDRb task to
synchronize the contents of tables in a MySQL database with the
contents of a legacy database via ODBC. Since records can be created
on both systems we use an increment of 5 paired with a different
starting offset (1 on the legacy system and 2 in MySQL) to guarantee
unique ids (e.g. ids would be 1, 6, 11... on the legacy system and 2,
7, 12... on MySQL ).