Resolve Rails 6.1 deprecation warning re: connection_config#365
Conversation
Prior to this change, the first interaction with the database would emit the following deprecation warning with Rails 6.1: > DEPRECATION WARNING: connection_config is deprecated and will be removed from Rails 6.2 (Use connection_db_config instead) For more info, see rails/rails#38005 which introduced the deprecation.
|
Thank you for this PR. Sorry it's taking a bit to take a look at, lots of time off over holidays 😄 . I'll get this tested & merged as soon as I can. |
| end | ||
|
|
||
| if adapter.nil? | ||
| adapter = ActiveRecord::Base.configurations[env]["adapter"] |
There was a problem hiding this comment.
Here is another depreciation, using [] for the configurations method. If it is your intention please consider replacing it with configs_for
adapter = ActiveRecord::Base.configurations.configs_for(env)["adapter"]There was a problem hiding this comment.
We have to be backwards compatible a long ways, so we can't just change it to that blindly. Do we hit this branch on 6.1+ after checking the line above with connection_db_config?
I'll have to check it out
@cschneid Any news on getting this merged or when we can expect it? Still getting this on 4.0.4. Thanks! |
|
Hi there - are there any updates on this? |
|
Hi - any idea when this will be merged and released? Or is there another way for us to avoid the deprecation warnings? |
|
Thanks for getting this merged in, @cschneid. 🙇 |
Prior to this change, the first interaction with the database would emit the following deprecation warning with Rails 6.1:
The deprecation was introduced in rails/rails#38005 and includes the following release notes:
Proposed resolution
With the changes in the pull request, Scout first attempts to use
connection_db_config. If unsuccessful, Scout falls back to the previous behavior of usingconnection_config.How to reproduce the deprecation warning
Verify you're using Rails 6.1:
Set up a new Rails app with scout_apm:
Load Scout and interact with the database: