fix: cast empty string to nil in atom

This commit is contained in:
Zach Daniel 2021-07-07 23:51:54 -04:00
parent e2cd33fac3
commit c9a19a7c2c

View file

@ -49,6 +49,8 @@ defmodule Ash.Type.Atom do
{:ok, value} {:ok, value}
end end
def cast_input(value, ""), do: nil
def cast_input(value, _) when is_binary(value) do def cast_input(value, _) when is_binary(value) do
{:ok, String.to_existing_atom(value)} {:ok, String.to_existing_atom(value)}
rescue rescue