diff options
author | Noé Froidevaux <noe.froidevaux@webdoc.com> | 2011-11-11 12:09:51 +0100 |
---|---|---|
committer | Noé Froidevaux <noe.froidevaux@webdoc.com> | 2011-11-11 12:09:51 +0100 |
commit | 27c5800c9cf8c19c3deb8bb6ebc1186d0f865d69 (patch) | |
tree | c85fe3cda343b0525407ecf9ea399d3ccae28e0f | |
parent | 7352efa6f87536af2bc22bef3f005ddfb793acc3 (diff) | |
download | rails-27c5800c9cf8c19c3deb8bb6ebc1186d0f865d69.tar.gz rails-27c5800c9cf8c19c3deb8bb6ebc1186d0f865d69.tar.bz2 rails-27c5800c9cf8c19c3deb8bb6ebc1186d0f865d69.zip |
Prevent multiple SHOW TABLES calls when a table don't exists in database.
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb | 6 |
1 files changed, 3 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 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: |