Skip to content

Instantly share code, notes, and snippets.

Last active Nov 21, 2020
What would you like to do?
user_status: <%= @user.status %>
<div class="mb-6">
<%= select(f, @user.status, @statuses) %>
UserStatusEnum.__enum_map__(): [inactive: 0, active: 1]
statuses: [inactive: 0, active: 1]
IO.inspect(UserStatusEnum.__enum_map__(), label: "UserStatusEnum.__enum_map__()")
statuses =, fn status ->
IO.inspect(statuses, label: "statuses")
assigns = [
conn: socket,
action: action,
csrf_token: csrf_token,
form_action: form_action,
changeset: changeset,
user: user,
statuses: statuses,
administrating_user: administrating_user,
orgs_admin: orgs_admin,
orgs_user: orgs_user,
orgs_invite: orgs_invite,
org_add_id: nil
{:ok, assign(socket, assigns)}
defenum UserStatusEnum, inactive: 0, active: 1
@derive {Inspect, except: [:password]}
@valid_locales ~w(en)
@email_regex ~r/\A([\w+\-].?)+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/i
@required_fields ~w(email username uuid)a
@optional_fields ~w(name phone_number locale)a
def email_regex(), do: @email_regex
schema "users" do
field :email, :string
field :username, :string
field :name, :string
field :phone_number, :string
field :confirmed_at, :naive_datetime
field :orgs_registered, {:array, :integer}, default: []
field :orgs_confirmed, {:array, :integer}, default: []
field :orgs_authorized, {:array, :integer}, default: []
field :uuid, Ecto.UUID
field :avatar, Markably.AvatarUploader.Type
many_to_many :orgs, Markably.Schema.Org, join_through: "orgs_users", on_replace: :delete
field :locale, :string
field :role, RolesEnum, default: :user
field :status, UserStatusEnum
Copy link

mazz commented Nov 21, 2020

Screen Shot 2020-11-21 at 12 25 40 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment