Last active
December 23, 2015 08:58
-
-
Save owenthereal/6610970 to your computer and use it in GitHub Desktop.
Quickly get it to work
This file contains 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
config1 = { :database => "db1", :host => "localhost", :port => 15432 } | |
spec1 = ActiveRecord::Base::ConnectionSpecification.new(config1, "postgresql_connection") | |
handler1 = ActiveRecord::ConnectionAdapters::ConnectionHandler.new | |
handler1.establish_connection("db1", spec1) | |
handler1.connection_pools.values.first.with_connection { ... } | |
config2 = { :database => "db2", :host => "localhost", :port => 15432 } | |
spec2 = ActiveRecord::Base::ConnectionSpecification.new(config2, "postgresql_connection") | |
handler2 = ActiveRecord::ConnectionAdapters::ConnectionHandler.new | |
handler2.establish_connection("db2", spec2) | |
handler2.connection_pools.values.first.with_connection { ... } | |
# rails runner multiple_connection_pools.rb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment