aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorJon Moss <me@jonathanmoss.me>2016-05-06 17:42:46 -0400
committerJon Moss <me@jonathanmoss.me>2016-05-07 17:41:11 -0400
commita8258e2bed3ce4f5592f7736607346e4fc47f1a1 (patch)
treea533f562db8dc0c028570d764905fef53763bff2 /activerecord
parent017c7f46e0aadffd2e5f02efb5918c0439716a7e (diff)
downloadrails-a8258e2bed3ce4f5592f7736607346e4fc47f1a1.tar.gz
rails-a8258e2bed3ce4f5592f7736607346e4fc47f1a1.tar.bz2
rails-a8258e2bed3ce4f5592f7736607346e4fc47f1a1.zip
Followup to #24844
Some slight documentation edits and fixes. Also, run remove unnecessary `RuntimeError`. r? @arthurnn
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb2
-rw-r--r--activerecord/lib/active_record/connection_handling.rb5
2 files changed, 4 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
index 4ba8ee2706..33f68d0b97 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
@@ -909,6 +909,8 @@ module ActiveRecord
# to optimise for.
def retrieve_connection_pool(spec_name)
owner_to_pool.fetch(spec_name) do
+ # Check if a connection was previously established in an ancestor process,
+ # which may have been forked.
if ancestor_pool = pool_from_any_process_for(spec_name)
# A connection was established in an ancestor process that must have
# subsequently forked. We can't reuse the connection, but we can copy
diff --git a/activerecord/lib/active_record/connection_handling.rb b/activerecord/lib/active_record/connection_handling.rb
index ba763149cc..a628ee4dbd 100644
--- a/activerecord/lib/active_record/connection_handling.rb
+++ b/activerecord/lib/active_record/connection_handling.rb
@@ -45,7 +45,7 @@ module ActiveRecord
# The exceptions AdapterNotSpecified, AdapterNotFound and +ArgumentError+
# may be returned on an error.
def establish_connection(spec = nil)
- raise RuntimeError, "Anonymous class is not allowed." unless name
+ raise "Anonymous class is not allowed." unless name
spec ||= DEFAULT_ENV.call.to_sym
resolver = ConnectionAdapters::ConnectionSpecification::Resolver.new configurations
@@ -93,8 +93,7 @@ module ActiveRecord
attr_writer :connection_specification_name
- # Return the specification id from this class otherwise look it up
- # in the parent.
+ # Return the specification name from the current class or its parent.
def connection_specification_name
unless defined?(@connection_specification_name)
@connection_specification_name = self == Base ? "primary" : superclass.connection_specification_name