From 8313e3359f0dde28d9940867c7ded964db4c854d Mon Sep 17 00:00:00 2001 From: Mihai Muntenas Date: Wed, 11 Sep 2024 19:04:08 +0200 Subject: [PATCH] fix: update ActiveRecord adapter w/ support for Rails 7.2+ (#478) In ActiveRecord 7.2 the `clear_active_connections` was (re)moved to the `connection_handler` property. --- lib/graphiti/adapters/active_record.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/graphiti/adapters/active_record.rb b/lib/graphiti/adapters/active_record.rb index c290f92c..ee66a8ef 100644 --- a/lib/graphiti/adapters/active_record.rb +++ b/lib/graphiti/adapters/active_record.rb @@ -304,7 +304,11 @@ def destroy(model_instance) end def close - ::ActiveRecord::Base.clear_active_connections! + if ::ActiveRecord.version > 7.2 + ::ActiveRecord::Base.connection_handler.clear_active_connections! + else + ::ActiveRecord::Base.clear_active_connections! + end end def can_group?