Re: multiple database users for rails app?

Ball, Donald A Jr \(Library\)
Mon, 22 Jan 2007 22:24:20 -0000

> > Ideally, I''d like to have two separate database.yml files,
> and choose
> > between them on a controller-by-controller basis. If this is a good
> > strategy, how might I go about doing it? If not, how would
y''all
> > suggest I structure my app?
> >
> > - donald
>
> Why not have a log-in action and if a user is successfully
> authenticated, store something in the session. Then you can
> check for the existence of this session variable and act accordingly.

That''s easy enough to do, but how do I "act accordingly"? How
do I tell
my controller that, based on the presence of this session property,
connect to the database using these credentials instead of those?

- donald