Why I get protocol Enumerable not implemented for #Ecto.Query?
<p>Although I am passing the query to repository inspired by <a href="https://stackoverflow.com/questions/32576899/phoenix-and-ecto-and-selects">this answer</a> like this:</p>

<pre><code>teams_users = Repo.all (from(t in Team, where: t.owner_id == ^user_id))
    |&gt; Enum.each( &amp;team_users/1 )


def team_users (team) do
    %{id: id} = team
    Repo.all (from(tu in TeamUser, where: tu.team_id == ^id))
end
</code></pre>

<p>However, I got this error:</p>

<pre><code>[error] GenServer #PID&lt;0.450.0&gt; terminating
** (Protocol.UndefinedError) protocol Enumerable not implemented for #Ecto.Query&lt;from t in App.Team, where: t.owner_id == ^1&gt;
    (elixir) lib/enum.ex:1: Enumerable.impl_for!/1
    (elixir) lib/enum.ex:116: Enumerable.reduce/3
    (elixir) lib/enum.ex:1477: Enum.reduce/3
    (elixir) lib/enum.ex:609: Enum.each/2
    (App) web/channels/user_channel.ex:93: App.UserChannel.handle_in/3
    (phoenix) lib/phoenix/channel/server.ex:223: Phoenix.Channel.Server.handle_info/2
    (stdlib) gen_server.erl:615: :gen_server.try_dispatch/4
    (stdlib) gen_server.erl:681: :gen_server.handle_msg/5
    (stdlib) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
</code></pre>

<p>What I am trying to do is to get all the teams, then get the users of each team, then I expect to have all the users in one array.</p>

<p>Do I miss something? any advice? is there a better way to achieve this?</p>