Connection not active after establish_connection since activerecord 7.2

Hi,

While upgrading to ActiveRecord 7.2 from 7.1 we noticed the following change:

# AR 7.1
ActiveRecord::Base.establish_connection(db_config)
puts ActiveRecord::Base.connection.active?
> true

This changed in AR 7.2 though:

# AR 7.2
ActiveRecord::Base.establish_connection(db_config)
puts ActiveRecord::Base.connection.active?
> false

I can’t find anything in the change log indicating this changed? So are there any implications due to this change?

We are using postgres 16.4 ruby 3.3

1 Like

This was indeed changed and clarified here: Calling connection.active? after establish_connection returns false since AR 7.2.0 · Issue #52858 · rails/rails · GitHub

2 Likes