fix: don't turn strings to atoms in :atom type

This commit is contained in:
Zach Daniel 2021-07-07 16:31:31 -04:00
parent 1d2befc6c9
commit a8b137c1bb

View file

@ -49,12 +49,7 @@ defmodule Ash.Type.Atom do
{:ok, value}
end
def cast_input(value, _) when is_binary(value) do
{:ok, String.to_existing_atom(value)}
rescue
ArgumentError ->
:error
end
def cast_input(_value, _), do: :error
@impl true
def cast_stored(value, _) when is_atom(value) do
@ -68,6 +63,8 @@ defmodule Ash.Type.Atom do
:error
end
def cast_stored(_, _), do: :error
@impl true
def dump_to_native(value, _) when is_atom(value) do
{:ok, to_string(value)}