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()