protocol Ecto.Queryable not implemented for Todo.User 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```
I have this error and I can't solve it, here is the error and the code
```elixir
defmodule TodoWeb.UserController do
use TodoWeb, :controller
def index(conn, _params) do
users = Todo.Repo.all(Todo.User)
render(conn, "index.json", users: users)
end
end
#Error during api creation
20 messages · Page 1 of 1 (latest)
Is there Todo.User module defined?
I don't think so, where can I define it?
So how Todo.Repo.all(Todo.User) is supposed to know what to do?
I am trying to retrieve all the items in my database :/
Ok, but how is repo supposed to know what table to query if you do not define schema for your query?
You need to define Todo.User module that will describe schema you want
So I have to create the model? Where do I create it?
Where you want/need
Where do you create your models in phoenix?
In my case? lib/<my_app>/<context>/<schema_name>.ex in most cases, but it highly depends. In your case I would start with some Phoenix tutorial if you do not understand that. See #getting-started for list of learning materials
Ok, I thinks it's good
But I have this error that corresponds to what?
no function clause matching in TodoWeb.UserController.create/2
You have no function TodoWeb.UserController.create/2
I highly suggest reading some tutorial
Well I think so
Ok, so there is, but it do not match