Forum: Ruby on Rails Get config hash for active connection

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
255fa588e4d48c0d6bfe7da572b3137c?d=identicon&s=25 bartocc (Guest)
on 2007-05-29 15:52
(Received via mailing list)

I want to use establish_connection for one of my classes, but I just
want to change the user and password, and keep the current connection
adapter and host.

I can call ActiveRecord::Base.connection to get the adapter object,
but I dont find how to extract the initial hash out of it.

How can I do that ?

Eb778b8bb642aa8a82c2b8b63705b6af?d=identicon&s=25 Jean-Etienne Durand (jetienne)
on 2007-05-29 16:49
abcs = ActiveRecord::Base.configurations
db_name = abcs[RAILS_ENV]["database"]

and so on...

This topic is locked and can not be replied to.