From 49b327e5faeac064f1cff98684488e3cefe95ee2 Mon Sep 17 00:00:00 2001 From: Philip Capel Date: Fri, 6 Mar 2026 14:16:50 -0600 Subject: [PATCH] fix: add handler for default_dynamic_expr with %Ash.Filter{} This addresses the issue where a nested filter expression is not properly cast into a dynamic expression compatible with Ecto. --- lib/expr.ex | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/expr.ex b/lib/expr.ex index 3cbf422..4069cb4 100644 --- a/lib/expr.ex +++ b/lib/expr.ex @@ -113,6 +113,21 @@ defmodule AshSql.Expr do {other, acc} end + defp default_dynamic_expr(_query, %Filter{expression: nil}, _bindings, _embedded?, acc, _type) do + {true, acc} + end + + defp default_dynamic_expr( + query, + %Filter{expression: expression}, + bindings, + embedded?, + acc, + type + ) do + do_dynamic_expr(query, expression, bindings, embedded?, acc, type) + end + defp default_dynamic_expr(query, %Not{expression: expression}, bindings, embedded?, acc, _type) do {new_expression, acc} = do_dynamic_expr(