Hi, I'm trying to understand the best way to get the connection to my databases.
At the moment I've got a method wich parses the url (depending on the url called the application has to connect to a different database, like customer1.xxx.com will connect to the customer1 database) and calls
ActiveRecord::Base.establish_connection(conn_string)
where conn_string contains the name of the database.
This method (set_db) is called with a
before_filter :set_db
in my Application controller, so basicly for each request I get, the url is parsed and the application try to do an establish_connection.
I was wondering if I can have a connection pool somewhere....do you have any suggestion about that? Is it better to have a Singleton which keep all the connections made and gives back the right one?
Thanks! Roberto