From 27c5800c9cf8c19c3deb8bb6ebc1186d0f865d69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noe=CC=81=20Froidevaux?= Date: Fri, 11 Nov 2011 12:09:51 +0100 Subject: Prevent multiple SHOW TABLES calls when a table don't exists in database. --- .../active_record/connection_adapters/abstract/connection_pool.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'activerecord/lib/active_record/connection_adapters/abstract') 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 77a5fe1efb..92dfb844db 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -123,14 +123,14 @@ module ActiveRecord # A cached lookup for table existence. def table_exists?(name) - return true if @tables.key? name + return @tables[name] if @tables.key? name with_connection do |conn| conn.tables.each { |table| @tables[table] = true } - @tables[name] = true if !@tables.key?(name) && conn.table_exists?(name) + @tables[name] = !@tables.key?(name) && conn.table_exists?(name) end - @tables.key? name + @tables[name] end # Clears out internal caches: -- cgit v1.2.3