Created
October 3, 2008 14:27
-
-
Save redsquirrel/14565 to your computer and use it in GitHub Desktop.
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
# Using ActiveRecord's trunk as of Oct 3, 2008, this fails with | |
# active_record/connection_adapters/abstract/connection_pool.rb:158:in `checkin': undefined method `run_callbacks' for nil:NilClass (NoMethodError) | |
config = { | |
:adapter => "mysql", | |
:host => "localhost", | |
:username => "root", | |
:database => "jackgroundrb_development" | |
} | |
ActiveRecord::Base.establish_connection(config) | |
class Promotion < ActiveRecord::Base; end | |
threads = [] | |
50.times do |i| | |
threads << Thread.new do | |
puts "-----#{i}-----" | |
ActiveRecord::Base.connection_pool.with_connection do |c| | |
c.execute("select * from promotions where id = 1") | |
end | |
puts "+++++#{i}+++++" | |
end | |
end | |
threads.each {|t| t.join} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment