mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 05:23:03 +12:00
fix: don't turn strings to atoms in :atom
type
This commit is contained in:
parent
1d2befc6c9
commit
a8b137c1bb
1 changed files with 3 additions and 6 deletions
|
@ -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)}
|
||||
|
|
Loading…
Reference in a new issue