From fc52089d9c302817f11d6a9fc52e461de9de6786 Mon Sep 17 00:00:00 2001 From: Dave Smylie Date: Thu, 1 Sep 2011 02:13:25 +0000 Subject: [PATCH] ActiveRecord::Base.allow_concurrency has been removed from Rails 3.0.3 - changed to check for this method and call Rails.application.config.allow_concurrency if it isn't present --- lib/spawn.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/spawn.rb b/lib/spawn.rb index 9b9ffa7..f5cf7e0 100644 --- a/lib/spawn.rb +++ b/lib/spawn.rb @@ -119,7 +119,8 @@ def spawn(opts = {}) options[:method].call(proc { yield }) elsif options[:method] == :thread # for versions before 2.2, check for allow_concurrency - if RAILS_2_2 || ActiveRecord::Base.allow_concurrency + if RAILS_2_2 || ActiveRecord::Base.respond_to?(:allow_concurrency) ? + ActiveRecord::Base.allow_concurrency : Rails.application.config.allow_concurrency thread_it(options) { yield } else @@logger.error("spawn(:method=>:thread) only allowed when allow_concurrency=true")