#model
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
#controller
class HomeController < ApplicationController
def index
[:development, :integration, :staging] do |env|
ApplicationRecord.establish_connection env
end
end
end
如果不断访问 home#index,不断切换 db 连接而没有手动释放连接,会对 service 造成什么负担吗?比如说达到一定次数以后连接池爆了?有什么改进方案没。求解惑