ExEnum - Enumerated type management package inspired by ActiveHash::Enum.
ExEnum is an enumerated type management package supporting Gettext, inspired by ActiveHash::Enum.
https://github.com/kenta-aktsk/ex_enum
Usage
defmodule MyApp.Status do
use ExEnum
row id: 0, type: :invalid, text: "invalid"
row id: 1, type: :valid, text: "valid"
accessor :type
end
You can use helper functions like below:
# index.html.eex
<td><%= Status.get(user.status).text %></td>
# form.html.eex
<%= select f, :status, Status.select([:text, :id]), class: "form-control" %>
# show.html.eex
<%= Status.get(@user.status).text %>
Read next Introducing Twilex, now you can send SMS/MMS with Elixir and Twilio