This sentence is part of the explanation of the for_user
reducer:
In our case, our classic reducer takes a
user_id
and transforms the initial query with an additionalwhere
clause.
The reducer function accepts a user
argument, not a user_id
.
def for_user(query \\ base(), user) do
query
|> where([d], d.user_id == ^user.id)
end