Programming Phoenix LiveView:B4.0(page 221)

Title: Programming Phoenix LiveView: (page 221)
In the part to open up IEx with iex -S mix and do the test drive of the query.
It was needed to added these alias on the Pento.Catalog.Product.Query module:

alias Pento.Survey.{Rating, Demographic}
alias Pento.Accounts.User

Because it complains to:

** (UndefinedFunctionError) function User.__schema__/1 is undefined (module User is not available)
    User.__schema__(:source)
    (ecto 3.6.1) lib/ecto/repo/queryable.ex:208: Ecto.Repo.Queryable.execute/4
    (ecto 3.6.1) lib/ecto/repo/queryable.ex:19: Ecto.Repo.Queryable.all/3

and after to add those alias the query worked!

Thanks for pointing this out! There is actually a line on page 219 that states:

Let’s add a few functions to the core in product/query.ex. First, make sure you alias Pento.Accounts.User and Pento.Survey.Demographic at the top of the Catalog.Product.Query module. 

And the code snippet on page 157 has you implement the original Pento.Catalog.Product.Query module with the alias: alias Pento.Survey.Rating

So I think that should cover it :slight_smile: