select database after login

Hi all,

is it possible to select the database after the user login? I need something like this: 1. Login screen where the user types in his username and password 2. Searching for the username in two databases (which have the same structure) 3. if username is found in on of the two databases, select this database for the whole session

I hope you understand what I mean.

Thanks for your responds!

You may be able to set up an abstract model with two child models in which each child uses a different database. One way to connect to different databases is by using the USE_DB gem. Once your user is logged in, you can set something in their session then somehow direct them to one database or the other by changing the value of the use_db call in the model.

Can I ask why you have two identically structured databases with different data for login? I'm interested in learning about the use case.

I’m thinking it might be a multi tenant, but with the same initial UI. That’s one possible use case.

Dheeraj Kumar