Skip to content

Commit

Permalink
Add backward-compatible support for Ecto < 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
remi committed Sep 22, 2024
1 parent 25f68b4 commit 887df27
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/absinthe_error_payload/changeset_parser.ex
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ defmodule AbsintheErrorPayload.ChangesetParser do

defp interpolated_value_to_string(value) when is_list(value), do: Enum.join(value, ",")

# Ecto < 3.12
defp interpolated_value_to_string({:parameterized, Ecto.Enum, %{on_load: mappings}}),
do: mappings |> Map.values() |> Enum.join(",")

# Ecto >= 3.12
defp interpolated_value_to_string({:parameterized, {Ecto.Enum, %{on_load: mappings}}}),
do: mappings |> Map.values() |> Enum.join(",")

Expand Down

0 comments on commit 887df27

Please sign in to comment.