Cannot expand struct - elixir/phoenix
Modules in Elixir need to be referred to by their full name or an alias
of it. You can either change all Locations
to AwesomeLunch.Locations
, or if you want to use a shorter name, you can call alias
in that module:
defmodule AwesomeLunch.LocationsController do
alias AwesomeLunch.Locations
...
end
I am developing an umbrella project and I was getting the same error some times.
If you create a struct declared in App1
, and want to use it in App2
you have to add App1
to App2
as dependency. If you don't do this and If App2
loaded before App1
the error occurs.
Example:
{:app1, in_umbrella: true}