Building Table Views with Phoenix LiveView: Starting code

The completed code is available, but is there somewhere to get the initial code for the application?

1 Like

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

This problem persists with no apparent attempt to address it by the author. I find that it renders the book nearly useless. Please address this issue.

1 Like

Hey folks, the author here. I’m sorry, I haven’t seen this post until now. If you have urgent matters like this, it’s always better to reach out to me via Twitter or my personal website.

Regarding the issue: The GitHub repo shows the completed code, which is the final result after you followed the book until the end. The intention is that you follow the book’s instructions and write the code yourself step-by-step. The GitHub repo is intended to show you the final result in case you only wanna see that, or to give you some help if you get lost. But feel free to create your own repo and publish the intermediary steps as well :slight_smile:

Best, Peter

Hi Peter,

Thanks for the answer. The problem is that the book assumes an existing project to work on. If this is simply an easily generated project it would be nice to have some instructions on generating it.

1 Like

@jmcochran there’s a starter-template of the project on GitHub now! If you unzip that file, you’ll have the starter project onto which we add the functionality in the book :slight_smile:

pragprog-book-tables-starter-app.zip