No function clause matching in Ecto.Repo.Queryable.all/3

Hi, newbie here.

Is it possible for someone to explain this error that im getting:

“no function clause matching in Ecto.Repo.Queryable.all/3”

The only thing im doing is simply:

user = Accounts.get_user!(id)

and get_user is:

  def get_user!(id) do
    User
    |> Repo.get!(User, id)
    |> Repo.preload(:credential)
  end

I dont understand any of that error, that is not related to my code. Any clues? thanks

Hi and welcome, there is a duplication of User in get_user! function:
It is piped as the first argument into Repo.get!, where it appears again as first argument.

It should be:

  def get_user!(id) do
    User
    |> Repo.get!(id)
    |> Repo.preload(:credential)
  end

Hth.

2 Likes

Yes, that is correct, thanks a lot @patrickdm. It’s weird because I was almost certain that I tried that option and did not work at the time.

But thanks a lot… after 4 hours of screaming like a little girl… its working.

2 Likes