aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2011-03-05 01:10:00 +0100
committerXavier Noria <fxn@hashref.com>2011-03-05 01:35:02 +0100
commit3b10b8a201d9fbef831be81d7a4bc9b82c75a6f4 (patch)
treefb2ece5916c226cdb0e00200bbc0286c1e9e110b /activerecord/lib/active_record/connection_adapters
parent28f1c21b50c17f9be9ea581c3a878186efb5b9ec (diff)
downloadrails-3b10b8a201d9fbef831be81d7a4bc9b82c75a6f4.tar.gz
rails-3b10b8a201d9fbef831be81d7a4bc9b82c75a6f4.tar.bz2
rails-3b10b8a201d9fbef831be81d7a4bc9b82c75a6f4.zip
implements ActiveRecord::Base.connection_config to be able to check the configuration of the current connection at runtime
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb
index 3716937689..d88720c8bf 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb
@@ -89,6 +89,16 @@ module ActiveRecord
retrieve_connection
end
+ # Returns the configuration of the associated connection as a hash:
+ #
+ # ActiveRecord::Base.connection_config
+ # # => {:pool=>5, :timeout=>5000, :database=>"db/development.sqlite3", :adapter=>"sqlite3"}
+ #
+ # Please use only for reading.
+ def connection_config
+ connection_pool.spec.config
+ end
+
def connection_pool
connection_handler.retrieve_connection_pool(self)
end