Skip to content

Instantly share code, notes, and snippets.

@cheeyeo
Forked from schneems/gist:5119875
Created March 22, 2013 22:26
Show Gist options
  • Save cheeyeo/5225252 to your computer and use it in GitHub Desktop.
Save cheeyeo/5225252 to your computer and use it in GitHub Desktop.
# Set the number of connections AR pool
#
# place in an initializer such as: config/connection_pool.rb
Rails.application.config.after_initialize do
ActiveRecord::Base.connection_pool.disconnect!
ActiveSupport.on_load(:active_record) do
config = Rails.application.config.database_configuration[Rails.env]
config['pool'] = ENV['DB_POOL'] || 6
ActiveRecord::Base.establish_connection(config)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment