Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save redsquirrel/14565 to your computer and use it in GitHub Desktop.
Save redsquirrel/14565 to your computer and use it in GitHub Desktop.
# 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