Two rails questions

Hi guys,

I’ve been trying to work out answers to the following problems for hours
but have reached the limit of my ruby knowledge! Any help will be
massively appreciated:

  1. When deploying a rails app to a web server (lightHTTP) and a FastCGI
    server with say 20 processes, do each of the processes run their own
    ruby instance? The reason I ask is using Globalize ruby (great package
    btw) accesses Local.set() which is a class method. Therefore if
    requests intertwine (can’t happen with threads as they don’t occur in
    ruby but could if processes running on same ruby instance?) users
    Locales will get messed up.

  2. Depending on the user logged in will depend on the database where
    their data is stored (different physical machine). How can I get a
    rails model to realize this? Using an ApplicationController I can
    connect to the correct database (we know the number in the session), but
    this causes a new connection on every request - not exactly efficient.
    Ideally I’d like connections to all the user clusters established and
    the model just uses the one it requires.

Thanks in advance for any help,

George