Prevent multiple SHOW TABLES calls when a table don't exists in database.

This commit is contained in:
Noé Froidevaux
2011-11-11 12:09:51 +01:00
parent 7352efa6f8
commit 27c5800c9c

View File

@@ -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: