Programming Phoenix LiveView: What should the Rating form look like? (page 216/217)

Currently the component looks like this:

<div>
  <.form :let={f} for={@changeset} phx-submit="save" phx-target={@myself} id={@id}>
    <.input field={{f, :user_id}} type="hidden" />
    <.input field={{f, :product_id}} type="hidden" />
    <.input
      field={{f, :stars}}
      type="rating"
      prompt="Rating"
      options={[
        "★★★★★": 5,
        "★★★★": 4,
        "★★★": 3,
        "★★": 2,
        "★": 1
      ]}
    />
    <.button phx-disable-with="Saving...">Save</.button>
  </.form>
</div>

However this gives me the following error:

Long error inside key :name not found in: %{__changed__: nil, __given__: %{__changed__: nil, field: {%Phoenix.HTML.Form{source: #Ecto.Changeset, valid?: false>, impl: Phoenix.HTML.FormData.Ecto.Changeset, id: "rating-form-1", name: "rating", data: %Pento.Survey.Rating{__meta__: #Ecto.Schema.Metadata<:built, "ratings">, id: nil, stars: nil, user_id: 1, user: #Ecto.Association.NotLoaded, product_id: 1, product: #Ecto.Association.NotLoaded, inserted_at: nil, updated_at: nil}, hidden: [], params: %{}, errors: [], options: [method: "post", id: "rating-form-1", multipart: false, "phx-submit": "save", "phx-target": %Phoenix.LiveComponent.CID{cid: 1}], index: nil, action: nil}, :user_id}, type: "hidden"}, errors: [], field: {%Phoenix.HTML.Form{source: #Ecto.Changeset, valid?: false>, impl: Phoenix.HTML.FormData.Ecto.Changeset, id: "rating-form-1", name: "rating", data: %Pento.Survey.Rating{__meta__: #Ecto.Schema.Metadata<:built, "ratings">, id: nil, stars: nil, user_id: 1, user: #Ecto.Association.NotLoaded, product_id: 1, product: #Ecto.Association.NotLoaded, inserted_at: nil, updated_at: nil}, hidden: [], params: %{}, errors: [], options: [method: "post", id: "rating-form-1", multipart: false, "phx-submit": "save", "phx-target": %Phoenix.LiveComponent.CID{cid: 1}], index: nil, action: nil}, :user_id}, id: nil, inner_block: [], label: nil, multiple: false, prompt: nil, rest: %{}, type: "hidden"}

What do I do to fix this?

The code in the book is working off of an outdated version of LiveView, and you appear to be using a newer version. You might find some help here Programming Phoenix LiveView: promo form requires "to_form" changes (p133) - #4 by SophieDeBenedetto. We are currently hard at work on an upgraded version of the whole book which will available for download in the next few weeks so stay tuned!