aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorMarcel Molina <marcel@vernix.org>2005-10-12 22:37:28 +0000
committerMarcel Molina <marcel@vernix.org>2005-10-12 22:37:28 +0000
commitb840e4ed509da433895fd2becf13f3e5656708e4 (patch)
tree7a23931ca5d7797ac00d9f3eb29e2e537abb00b2 /activerecord/lib
parent0e0e774085c478a171894abfa95fff9475a4a826 (diff)
downloadrails-b840e4ed509da433895fd2becf13f3e5656708e4.tar.gz
rails-b840e4ed509da433895fd2becf13f3e5656708e4.tar.bz2
rails-b840e4ed509da433895fd2becf13f3e5656708e4.zip
Deprecated ActiveRecord::Base.threaded_connection in favor of ActiveRecord::Base.allow_concurrency.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2542 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-xactiverecord/lib/active_record/base.rb23
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb2
2 files changed, 18 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 16d9579ed0..b28247769f 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -235,7 +235,7 @@ module ActiveRecord #:nodoc:
# also be used to "borrow" the connection to do database work unrelated
# to any of the specific Active Records.
def self.connection
- if @@threaded_connections
+ if allow_concurrency
retrieve_connection
else
@connection ||= retrieve_connection
@@ -301,9 +301,9 @@ module ActiveRecord #:nodoc:
# Determines whether or not to use a connection for each thread, or a single shared connection for all threads.
# Defaults to true; Railties' WEBrick server sets this to false.
- cattr_accessor :threaded_connections
- @@threaded_connections = true
-
+ cattr_accessor :allow_concurrency
+ @@allow_concurrency = true
+
# Determines whether to speed up access by generating optimized reader
# methods to avoid expensive calls to method_missing when accessing
# attributes by name. You might want to set this to false in development
@@ -787,6 +787,17 @@ module ActiveRecord #:nodoc:
def ===(object)
object.is_a?(self)
end
+
+ # Deprecated
+ def threaded_connections
+ allow_concurrency
+ end
+
+ # Deprecated
+ def threaded_connections=(value)
+ self.allow_concurrency = value
+ end
+
private
# Finder methods must instantiate through this method to work with the single-table inheritance model
@@ -932,7 +943,7 @@ module ActiveRecord #:nodoc:
end
def scope_constraints
- if @@threaded_connections
+ if allow_concurrency
Thread.current[:constraints] ||= {}
Thread.current[:constraints][self] ||= {}
else
@@ -943,7 +954,7 @@ module ActiveRecord #:nodoc:
alias_method :scope_constrains, :scope_constraints
def scope_constraints=(value)
- if @@threaded_connections
+ if allow_concurrency
Thread.current[:constraints] ||= {}
Thread.current[:constraints][self] = value
else
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb
index caf4ba75de..b5ddef32af 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb
@@ -62,7 +62,7 @@ module ActiveRecord
end
def self.active_connections #:nodoc:
- if threaded_connections
+ if allow_concurrency
Thread.current['active_connections'] ||= {}
else
@@active_connections ||= {}