aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorNick Sieger <nick@nicksieger.com>2008-08-08 00:45:16 -0700
committerNick Sieger <nick@nicksieger.com>2008-08-29 14:12:11 -0500
commitd7d2d73d88e465cb0c618283862179accd8932e1 (patch)
treedf09c84bf9ea742bf2a8e061e78791d9fca96a02 /activerecord
parent1712e37c90d0ac74b21589c0ee7b0365cb2b7beb (diff)
downloadrails-d7d2d73d88e465cb0c618283862179accd8932e1.tar.gz
rails-d7d2d73d88e465cb0c618283862179accd8932e1.tar.bz2
rails-d7d2d73d88e465cb0c618283862179accd8932e1.zip
Fix typo: was using brackets instead of parens. Must need more sleep.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb2
-rw-r--r--activerecord/test/cases/threaded_connections_test.rb10
2 files changed, 11 insertions, 1 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 1d7efc89e1..988f85e909 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
@@ -266,7 +266,7 @@ module ActiveRecord
end
def checkout_existing_connection
- c = [@connections - @checked_out].first
+ c = (@connections - @checked_out).first
@checked_out << c
c
end
diff --git a/activerecord/test/cases/threaded_connections_test.rb b/activerecord/test/cases/threaded_connections_test.rb
index a9d82037bc..892a99f85a 100644
--- a/activerecord/test/cases/threaded_connections_test.rb
+++ b/activerecord/test/cases/threaded_connections_test.rb
@@ -105,5 +105,15 @@ unless %w(FrontBase).include? ActiveRecord::Base.connection.adapter_name
assert_equal 3, @connection_count
assert_equal 0, @timed_out
end
+
+ def test_pooled_connection_checkout_existing_first
+ ActiveRecord::Base.establish_connection(@connection.merge({:pool => 1}))
+ conn_pool = ActiveRecord::Base.connection_pool
+ conn = conn_pool.checkout
+ conn_pool.checkin(conn)
+ conn = conn_pool.checkout
+ assert ActiveRecord::ConnectionAdapters::AbstractAdapter === conn
+ conn_pool.checkin(conn)
+ end
end
end