Working my way through the Phoenix in Action book at chapter 7.5.3, and I’m getting the following error:
** (Protocol.UndefinedError) protocol Ecto.Queryable not implemented for Item of type Atom, the given module does not exist. This protocol is implemented for the following type(s): Atom, BitString, Ecto.Query, Ecto.SubQuery, Tuple
(ecto) lib/ecto/queryable.ex:40: Ecto.Queryable.Atom.to_query/1
(ecto) lib/ecto/repo/queryable.ex:14: Ecto.Repo.Queryable.all/3
I’m sort of stuck as I had this working yesterday. Help Please. This is my repo mpchean/auction_umbrella
protocol Ecto.Queryable not implemented for Category of type Atom, the given module does not exist. This protocol is implemented for the following type(s): Atom, BitString, Ecto.Query, Ecto.SubQuery, Tuple
In my Catalog.ex file (Catalog is the context for Category and Product), I have the function defined as:
defmodule Hello.Catalog do
The Catalog context.
import Ecto.Query, warn: false
def get_product!(id) do
Product |> Repo.get(id) |> Repo.preload(:categories)
The get_product! function is where the error originates from when I visit /products/1
I guess the alias is already given, so why is it still causing the error?