I'm trying to create a join table, and I'm running into this error while trying to build a struct.
ERROR
protocol Enumerable not implemented for %Statcasters.UsersLeagues{meta: #Ecto.Schema.Metadata<:built, "users_leagues">, commissioner: nil, id: nil, inserted_at: nil, league: #Ecto.Association.NotLoaded, league_id: nil, updated_at: nil, user: #Ecto.Association.NotLoaded, user_id: nil}. This protocol is implemented for: DBConnection.PrepareStream, DBConnection.Stream, Date.Range, Ecto.Adapters.SQL.Stream, File.Stream, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, List, Map, MapSet, Postgrex.Stream, Range, Stream, Timex.Interval
It's failing on this line:
LEAGUE CONTROLLER:
def new(conn, _params) do
changeset = League.changeset(%League{users_leagues: %UsersLeagues{}})
render(conn, "new.html", changeset: changeset)
end
I have a has_many through relationship with leagues and users. The join table is the users_leages table and that is what I'm trying to create in the new action. But when I try to load the new page. it breaks with this error.
%UsersLeagues{}to[%UsersLeagues{}]. - Dogbert