Skip to content

Commit 2a048d2

Browse files
committed
Use model.arel_table in get_all for Rails main compatibility
Rails main (rails/rails#57021) makes Arel::Table.new keyword-only, so the positional Arel::Table.new(table_name.to_sym) calls in get_all raise ArgumentError: wrong number of arguments (given 1, expected 0). Because the memoizer middleware calls preload_all on every request, this breaks every request on apps tracking Rails main. ActiveRecord::Base.arel_table returns the same table and is stable across all supported Rails versions (5.2-8.0 and main), so it avoids the constructor signature entirely.
1 parent 615dd52 commit 2a048d2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/flipper/adapters/active_record.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ def get_multi(features)
106106
def get_all(**kwargs)
107107
with_connection(@feature_class) do |connection|
108108
# query the gates from the db in a single query
109-
features = ::Arel::Table.new(@feature_class.table_name.to_sym)
110-
gates = ::Arel::Table.new(@gate_class.table_name.to_sym)
109+
features = @feature_class.arel_table
110+
gates = @gate_class.arel_table
111111
rows_query = features.join(gates, ::Arel::Nodes::OuterJoin)
112112
.on(features[:key].eq(gates[:feature_key]))
113113
.project(features[:key].as('feature_key'), gates[:key], gates[:value])

0 commit comments

Comments
 (0)