Skip to content

Commit

Permalink
Address deprecation of ActiveRecord::Base.connection
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuay03 committed Jun 12, 2024
1 parent 5aa9cfd commit 28a27d9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/flipper/adapters/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)|
Expand Down

0 comments on commit 28a27d9

Please sign in to comment.