diff options
author | Hongli Lai (Phusion) <hongli@phusion.nl> | 2008-09-17 15:28:52 +0200 |
---|---|---|
committer | Hongli Lai (Phusion) <hongli@phusion.nl> | 2008-09-17 15:28:52 +0200 |
commit | 161647ea8998ca78c39d8d78c196cef32ca7baa2 (patch) | |
tree | 9efe60c7415862bb0bca70c09358eeb4545a693e | |
parent | d0f7ec35a6a5f3bd80d682517fbb526b7e475f65 (diff) | |
download | rails-161647ea8998ca78c39d8d78c196cef32ca7baa2.tar.gz rails-161647ea8998ca78c39d8d78c196cef32ca7baa2.tar.bz2 rails-161647ea8998ca78c39d8d78c196cef32ca7baa2.zip |
Improve documentation for the connection methods in AbstractAdapter.
-rwxr-xr-x | activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index 7c37916367..6c96ed5b35 100755 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -91,17 +91,21 @@ module ActiveRecord # CONNECTION MANAGEMENT ==================================== - # Is this connection active and ready to perform queries? + # Checks whether the connection to the database is still active. This includes + # checking whether the database is actually capable of responding, i.e. whether + # the connection isn't stale. def active? @active != false end - # Close this connection and open a new one in its place. + # Disconnects from the database if already connected, and establishes a + # new connection with the database. def reconnect! @active = true end - # Close this connection + # Disconnects from the database if already connected. Otherwise, this + # method does nothing. def disconnect! @active = false end @@ -121,15 +125,19 @@ module ActiveRecord false end - # Verify this connection by calling <tt>active?</tt> and reconnecting if - # the connection is no longer active. + # Checks whether the connection to the database is still active (i.e. not stale). + # This is done under the hood by calling <tt>active?</tt>. If the connection + # is no longer active, then this method will reconnect to the database. def verify!(*ignored) reconnect! unless active? end - # Provides access to the underlying database connection. Useful for - # when you need to call a proprietary method such as postgresql's lo_* - # methods + # Provides access to the underlying database driver for this adapter. For + # example, this method returns a Mysql object in case of MysqlAdapter, + # and a PGconn object in case of PostgreSQLAdapter. + # + # This is useful for when you need to call a proprietary method such as + # PostgreSQL's lo_* methods. def raw_connection @connection end |