Cast_embed causing error

@outlog, Yes, that is definitely the case. Thankyou! I also had to add (per error messages), a changeset to the Child module, like the below. Then everything works.

defmodule Child do
  use Ecto.Schema
  import Ecto.Changeset

  embedded_schema do
    field :level, :integer
    field :title, :string
    field :doc_id, :integer
    field :doc_identifier, :string
  end

  def changeset(%Child{} = child, attrs) do
    child
    |> cast(attrs, [:level, :title, :doc_id, :doc_identifier])
  end

end
1 Like