<p>In our program, each customer gets their own database.  We e-mail them a link that connects them to their database.  The link contains a GUID that lets the program know which database to connect to.</p>

<p>How do I dynamically and programatically connect ActiveRecord to the right db?</p>

you can change the connection to ActiveRecord at any time by calling ActiveRecord::Base.establish_connection(...)
IE:
```
```
ActiveRecord::Base.establish_connection({:adapter => "mysql", :database => new_name, :host => "olddev",
    :username => "root", :password => "password" })
```
```