Getting Data from 'model'

Writing my first phoenix app…
Want to display a list of ‘tags’ in page/index.html

In Rails it would be:

@tags=Tag.all

How do I get this in Phoenix?
Any alias needed?

page_controller

defmodule MyappWeb.PageController do
  use MyappWeb, :controller

   ///? alias Myapp.Projects.Tag

def index(conn, _params) do
  tags = Repo.all(Tag)
  render(conn, "index.html", tags: tags)
end

My tags model is under lib/myapp/projects/projects.ex

I cant find anything on google.

Thanks for support.

Yes you’ll need to alias your Tag module name in the Controller module.

Or fully qualify its name.

Thanks for support…

  alias Myapp.Projects
  alias Myapp.Projects.Tag

  def index(conn, _params) do
    tags = Projects.list_tags()
    render(conn, "index.html", tags: tags)
  end

works