Skip to content

Commit

Permalink
use Ecto.Enum for order status
Browse files Browse the repository at this point in the history
  • Loading branch information
RudolfMan committed Apr 16, 2022
1 parent 9e99095 commit 17ad5cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/acme/orders/order.ex
Expand Up @@ -4,7 +4,7 @@ defmodule Acme.Orders.Order do

schema "orders" do
field :account_id, :integer
field :status, :integer
field :status, Ecto.Enum, values: [placed: 1, shipped: 2, delivered: 3]

timestamps()
end
Expand Down
2 changes: 1 addition & 1 deletion lib/acme_web/live/order_live/form_component.html.heex
Expand Up @@ -14,7 +14,7 @@
<%= error_tag f, :account_id %>

<%= label f, :status %>
<%= number_input f, :status %>
<%= select f, :status, Ecto.Enum.values(Orders.Order, :status), prompt: "Order status" %>
<%= error_tag f, :status %>

<div>
Expand Down

0 comments on commit 17ad5cb

Please sign in to comment.