Skip to content

Instantly share code, notes, and snippets.

@ono
Last active January 13, 2018 12:34
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 ono/92f5fe4e976b6f623749357f228384de to your computer and use it in GitHub Desktop.
Save ono/92f5fe4e976b6f623749357f228384de to your computer and use it in GitHub Desktop.
defmodule MyApp.Category do
use Ecto.Schema
alias MyApp.Category
schema "categories" do
field :name, :string
field :description, :string
field :display_order, :integer
embeds_many :children, Child, [on_replace: :delete] do
belongs_to :category, Category
end
timestamps()
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment