Skip to content

Instantly share code, notes, and snippets.

@talum
Created May 28, 2019 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save talum/2ebe97b9f85907f8705cc8a6a3180f24 to your computer and use it in GitHub Desktop.
Save talum/2ebe97b9f85907f8705cc8a6a3180f24 to your computer and use it in GitHub Desktop.
Changeset demo
iex> attributes = %{amount_due: 3000, due_date: "2019-04-30", scheduled_send_date: "2019-04-25",
iex> closed_at: "2019-05-01"}
iex> changeset = Registrar.Billing.Invoice.changeset(%Invoice{}, attributes)
iex> #Ecto.Changeset<
  action: nil,
  changes: %{amount_due: 3000, due_date: ~D[2019-04-30], scheduled_send_date: ~D[2019-04-25]},
  errors: [],
  data: #Registrar.Billing.Invoice<>,
  valid?: true
>
iex> changeset.changes
iex> %{amount_due: 3000, due_date: ~D[2019-04-30], scheduled_send_date: ~D[2019-04-25]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment