I'm completely new to RoR and don't know how to exactly achieve the
With our old web app we switched the database depending on the domain
name so that we could use one application for multiple customers:
> xy.com > Database Xy
> yz.com > Database Yz
This changed the database at the beginning of each visitor/users
session. Is something like this achievable with RoR?
there are a few options, but ultimately you'll need to...
:adapter => mysql,
:host => localhost,
:username => xyz,
:password => password,
:database => params['dbinfo']
Where *params['dbinfo']* is the variable containing your database name.
this will set the connection to whichever database you need. You won't
(I don't think) be able to do this within the model class. You'll have
to do it in a controller. Although you might want a default setting in
the model class, for console work and such.