From 54c96349435e3e80d25999aa53e53224b7cbd578 Mon Sep 17 00:00:00 2001 From: Thomas Fortes Date: Wed, 18 Dec 2024 18:02:57 -0300 Subject: [PATCH] Fix error showing when field not used --- lib/backpex/fields/has_many.ex | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/backpex/fields/has_many.ex b/lib/backpex/fields/has_many.ex index e856626d..4abb94e6 100644 --- a/lib/backpex/fields/has_many.ex +++ b/lib/backpex/fields/has_many.ex @@ -207,7 +207,7 @@ defmodule Backpex.Fields.HasMany do - + + + filtered_ids = Enum.reject(ids, &(&1 == "")) + schema - |> where([x], x.id in ^ids) + |> where([x], x.id in ^filtered_ids) |> maybe_options_query(field_options, assigns) |> repo.all()