Sinatra 1.3.6 activerecord 3.1 connect to multiple databases

18 Views Asked by At

I am working on a legacy application which is Sinatra 1.3.6, sinatra-activerecord 1.2.1 and activerecord 3.1. It connects old mysql DB host.

With this I am facing a challenge connecting with multiple databases in the activerecord connection_handler.

With the first database I connect with set :database, connection_hash it works. When I try to connect to the second database by defining a new model with the establish_connection method the connection object contains the right information but the connection_handler object has the information for the first database.

I looked at gems like db-charmer to see if it can do the trick but it has rails dependencies.

I would really appreciate help on this.

Thank you, Gaurav

Tried researching online.

0

There are 0 best solutions below