Skip to content

Commit

Permalink
fix filter
Browse files Browse the repository at this point in the history
  • Loading branch information
omohokcoj committed Oct 5, 2024
1 parent 4836973 commit b3262d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion lib/motor/api_query/filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ def apply_filters(rel, filters)

rel = apply_predicates(rel, filters)

alias_tracker = ActiveRecord::Associations::AliasTracker.create(rel.connection, rel.table.name, [])
alias_tracker =
if Rails.version.to_f >= 7.2
rel.alias_tracker
else
ActiveRecord::Associations::AliasTracker.create(rel.connection, rel.table.name, [])
end

filter_clause_factory = ActiveRecord::Relation::FilterClauseFactory.new(rel.klass, rel.predicate_builder)

where_clause = filter_clause_factory.build(filters, alias_tracker)
Expand Down
2 changes: 1 addition & 1 deletion lib/motor/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Motor
VERSION = '0.4.30'
VERSION = '0.4.31'
end

0 comments on commit b3262d9

Please sign in to comment.