Fixed ActiveRecord connections management