I am currently creating a rails app where I have to switch between several databases. These databases have the same tables but each one represents a different hotel(i.e: hotel1 has database1, hotel2 has database2 and so on) .This happens because each costumer is a different client for our business. Now here is the tricky part: Some users may have access to more than one hotel (lets say there is a chain manager who can see the status of all the hotels associated to that chain). I've seen different threads where rails connects to multiple databases but not with the number of databases I need to implement (the business is growing). Also, this databases are in the same server so I understand that switching between should not be rocket science.
Things to keep in mind:
The big question: Since these databases are not rails databases and I need to execute queries on each one them, what is the "rails way" to do this allowing me to escalate the solution in the future? (add more queries in the future). Should I model these non-rails databases as Poros in my app? Is there a design pattern that can help me with this?
Please look at following gems apartment and act_as_tenant. Your requirement are very much similar to what these gem offers apart from some users may have access to more than one hotel but i think still this is achievable with these gems