mperham / connection_pool

Generic connection pooling for Ruby
MIT License
1.63k stars 143 forks source link

More than one connection pool #62

Closed rainerborene closed 10 years ago

rainerborene commented 10 years ago

For each database entry I want to create a connection pool. How can I achieve that using this gem? Thanks

class User < ActiveRecord::Base
  has_many :databases
end

class Database < ActiveRecord::Base
  belongs_to :user
  # attributes: host, name, username, password
end

# usage
database = Database.first
database.with do |conn|
  conn.exec("select 1")
end
mperham commented 10 years ago

This is a StackOverflow question, not an issue.