Building Table Views with Phoenix LiveView: Starting code

I have the same issue, the book refers to code that is seemingly a previous iteration of what is available on github. There’s no direct means of following along with the book as the code referenced doesn’t exist.

e.g.

Open up lib/meow_web/live/meerkat_live.ex, and you’ll see our basic MeerkatLive-LiveView for displaying the meerkat data.

defmodule MeowWeb.MeerkatLive do use MeowWeb, :live_view
  alias Meow.Meerkats
  def mount(_params, _session, socket), do: {:ok, socket}
  def handle_params(_params, _url, socket) do {:noreply, assign_meerkats(socket)}
  end

  defp assign_meerkats(socket) do
    assign(socket, :meerkats, Meerkats.list_meerkats())
  end 

end

The referenced module is actually 85 lines long and doesn’t include an implementation of assign_meerkats as referenced above https://github.com/PJUllrich/pragprog-book-tables/blob/main/lib/meow_web/live/meerkat_live.ex

1 Like