Displaying 1 result from an estimated 1 matches for "clear_connect".
Did you mean:
clarkconnect
2006 Jan 26
0
If you want to disconnect a database properly, there is the code:)!!!
...# methode "close" is exported by the postgres.so for
disconnect the database
@connection.close
@connection = nil # clear the connection
end
end
In connection_specification.rb, add the following code
at the end (in the "ActiveRecord::Base" class section)
def self.clear_connection(klass=self)
@@defined_connections.delete(klass) # remove
the connection
ac = active_connections # get the active
connection
ac.delete(klass) if ac.kind_of?(Hash) #
remove the connection
self.connection.disconnect # disconnect the
link with database, it call...