Using the code: class GeorgeDatabase < ActiveRecord::Base self.abstract_class = true establish_connection "#{RAILS_ENV}_user" end 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 or development_user7 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! George -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---