This blog is part of our Rails 6 series.
Rails 6.0 was recently released.
Rails 6 changed the return value of ActiveRecord::Base.configurations to an object of
ActiveRecord::DatabaseConfigurations. Before Rails 6, ActiveRecord::Base.configurations returned a hash with all the database configurations. We can call
to_h on the object of
ActiveRecord::DatabaseConfigurations to get a hash.
A method named configs_for has also been added on to fetch configurations for a particular environment.
Here is the relevant