I''m having problems with active_record within threads I have some code that works alone, but if I insert it into a thread with: threads = [] for x in 1..5 do threads << Thread.new do team = Team.find(2) end end threads.each do |t| t.join end That code fails with: /usr/local/lib/site_ruby/1.8/active_record/connection_adapters/abstract_adapter.rb:147:in `log'': Mysql::Error: Lost connection to MySQL server during query: SELECT * FROM `teams` WHERE (`teams`.`id` = 2) (ActiveRecord::StatementInvalid) from simm.rb:311:in `join'' from simm.rb:311 from simm.rb:310:in `each'' from simm.rb:310 Seems the connection goes away inside threads, isn''t it? It works without threads... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---