Last active
December 14, 2015 17:09
-
-
Save schneems/5119875 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
@hgmnz any initializer should work, unless you're doing something screwy like this in another initializer and order might matter.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
not in config/initializers/whatevs?