The module AdminRolesEnum can’t be directly piped into an Enum.map function, hence the error you’re getting. Elixir modules are actually Atoms behind the scenes if I recall correctly. If you really need/want to use the EctoEnum library, take a look at the functions below. The post you linked pipes the result of the enum map function into the Enum.map, not the module.
The enum type StatusEnum will also have a reflection function for inspecting the enum map at runtime.
You could store it in the database on a separate table eg an AdminRole schema and admin_roles table with columns for role name and description. There are lots of guides on setting up user roles through associations out there.
If I run AdminRolesEnum.__enum_map__() |> Enum.map(&to_string(elem(&1, 0))) from iex (or from within the html file)
I get: * 2nd argument: not a tuple
I’m also tried using it in a function like U suggest. I’m so new to Phoenix that I can’t even figure how to pass the function from the controller to the view. Not sure if this would make any difference anyway