Using the code:
class GeorgeDatabase < ActiveRecord::Base
self.abstract_class = true
I can ensure all subclasses of GeorgeDatabase use the same database for
data access. Perfect for when my application uses several databases.
However, depending on the user logged in depends which database their
data is stored in. My login code returns this database number which I’d
like to append to the string above to give for example development_user1
Problem is I can’t work out how! The number is currently stored in the
session at the controller level. This can’t set a variable in
GeorgeDatabase as the same instance won’t be used by the model subclass
when its constructed. Equally I can’t access a variable in my login
controller as it doesn’t know the instance.
Any ideas on how to solve this would be massively apprecitated!