Get config hash for active connection


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 ?


abcs = ActiveRecord::Base.configurations
db_name = abcs[RAILS_ENV][“database”]

and so on…


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs