I want to use Atoms as enum(in other language) to do matching more than true/false two states, like :apple , :banana, :carrot. But after many of googling, not able to find how to save/retrieve those atoms to/from database in Ecto. Any idea? thanks.
what_to_eat = get_atom_from_ecto(fruit_type)
case what_to_eat do
:apple -> "here is your apple"
:banana -> "here is banana"
:carrot -> "have this carrot"
_ -> "any fruit, don't care"
end
I am not sure :erlang.term_to_binary(anything) is the way to go, but worry if the binary of atom not able to see in database as text.


















