Hi Fred, thanks for your reply!
I'm using authlogic gem to authenticate my users.
Inside my Application Controller I created the following code:
prepend_before_filter :database_connection
and this method has the following code:
ActiveRecord::Base.establish_connection({:adapter => "mysql", :database => "#{current_user.dbname}", :username => "x", :password => "x", :host => "x", :encoding => "utf8"})
So, for each request I get the current authenticated user database name and set the connection to customer database.
Since each user had authenticated using their own username/passwd, each request will establish a different connection to the database.
But if Rails doesn't cache database queries for different time requests, I'm lost about why this issue is happening.
Do you have any clue?
Best regards