1

我正在使用以下类连接到辅助数据库,但我认为我已达到最大连接池,因为此类被频繁调用,并且我随机无法从查询中获取结果。有人可以帮助我使用语法以确保在运行使用该类的块或方法后我签入和签出连接吗?

class ReadDatabaseConnection < ActiveRecord::Base
    self.abstract_class=true
    self.table_name = "ATableName"
 end

def amethod
        ReadDatabaseConnection.establish_connection(@db_connection)
        records = ReadDatabaseConnection.where(condition)
end
4

0 回答 0