RE: [Rails] Re: multiple database users for rails app?

> 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

Sounds to me like you want two DB connections, one for each user. Use the session variable to choose which connection to use. Multiple connections to one db should be equivalent to connecting to multiple databases: rails multiple databases - Google Search