From b33811ba733e680e19a7825ccdf338e1eb475f2a Mon Sep 17 00:00:00 2001 From: Joshua Young Date: Wed, 12 Jun 2024 11:27:28 +1000 Subject: [PATCH] Address soft deprecation of `ActiveRecord::Base.connection` --- lib/flipper/adapters/active_record.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/flipper/adapters/active_record.rb b/lib/flipper/adapters/active_record.rb index 9dce74b2..5b869bdc 100644 --- a/lib/flipper/adapters/active_record.rb +++ b/lib/flipper/adapters/active_record.rb @@ -130,14 +130,14 @@ def get_multi(features) end def get_all - with_connection(@feature_class) do + with_connection(@feature_class) do |connection| # query the gates from the db in a single query features = ::Arel::Table.new(@feature_class.table_name.to_sym) gates = ::Arel::Table.new(@gate_class.table_name.to_sym) rows_query = features.join(gates, ::Arel::Nodes::OuterJoin) .on(features[:key].eq(gates[:feature_key])) .project(features[:key].as('feature_key'), gates[:key], gates[:value]) - gates = @feature_class.connection.select_rows(rows_query) + gates = connection.select_rows(rows_query) # group the gates by feature key grouped_gates = gates.inject({}) do |hash, (feature_key, key, value)|