Active Record multiple databases with same table schemas

We probably need to have a sinatra web server where different clients through different sessions each have different databases but with the same tables.
If I have an active record class such as MyFoo, it would be ideal for it to be for table foo on either db1, db2, etc. If I have MyFoo1 and MyFoo2, I can set
MyFoo as a constant to each of those ie MyFoo = MyFoo2 (MyFoo on database 2), but every time I am in a new session I have to delete the old constant
and set it to the new one. I am not sure that is the only way. I guess I could somehow write a class MyFoo that uses method_missing and then figures out the correct active record instance, but not sure if there was an easier way ?

my test program: