Fix failure to retain value of allow_concurrency

- Also carry allow_concurrency value through to connection adapter
  (for postgresql)
This commit is contained in:
Nick 2008-04-19 23:11:28 -05:00 committed by Nick Sieger
parent cab76ce6ac
commit 37b0b36918
2 changed files with 3 additions and 1 deletions

View File

@ -97,7 +97,8 @@ module ActiveRecord
if spec.kind_of?(ActiveRecord::ConnectionAdapters::AbstractAdapter)
active_connections[active_connection_name] = spec
elsif spec.kind_of?(ActiveRecord::Base::ConnectionSpecification)
self.set_connection ActiveRecord::Base.send(spec.adapter_method, spec.config)
config = spec.config.reverse_merge(:allow_concurrency => ActiveRecord::Base.allow_concurrency)
self.set_connection ActiveRecord::Base.send(spec.adapter_method, config)
else
raise ConnectionNotEstablished
end

View File

@ -31,6 +31,7 @@ module ActiveRecord
# multi-threaded access of the connection pools hash is synchronized.
def allow_concurrency=(flag)
if @@allow_concurrency != flag
@@allow_concurrency = flag
if flag
self.connection_pools_lock = Monitor.new
else