Fix connection reloading in development mode. [#4929 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
Edgars Beigarts 2010-06-22 11:48:11 +03:00 committed by José Valim
parent c0fc084e93
commit 62c4e4d385
2 changed files with 6 additions and 3 deletions

View File

@ -144,7 +144,9 @@ module ActiveRecord
@connections.each do |conn|
conn.disconnect! if conn.requires_reloading?
end
@connections = []
@connections.delete_if do |conn|
conn.requires_reloading?
end
end
# Verify active connections and remove and disconnect connections

View File

@ -142,9 +142,10 @@ module ActiveRecord
# this should be overridden by concrete adapters
end
# Returns true if its safe to reload the connection between requests for development mode.
# Returns true if its required to reload the connection between requests for development mode.
# This is not the case for Ruby/MySQL and it's not necessary for any adapters except SQLite.
def requires_reloading?
true
false
end
# Checks whether the connection to the database is still active (i.e. not stale).