You don’t have to assume that schema is Post and don’t use any Repo functions in model I guess:
def get_published(query) do
from p in query,
where: p.published == true
end
Based on this func, use in controller Post.get_published(Post) |> Repo.all()
Remember that queries in Ecto are composable, so you can chain them together






















