Skip to content

Commit

Permalink
Add additional info on preloads
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Aug 31, 2023
1 parent 66a14d4 commit a2e5b82
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/ecto/query.ex
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ defmodule Ecto.Query do
end

defp types!(fields, types) do
Enum.map(fields, fn field->
Enum.map(fields, fn field ->
case types do
%{^field => type} ->
{field, type}
Expand Down Expand Up @@ -2542,6 +2542,9 @@ defmodule Ecto.Query do
posts_query = from p in Post, where: p.state == :published
Repo.all from a in Author, preload: [posts: ^{posts_query, [:comments]}]
If you prefer, you can also add additional preloads directly in the
`posts_query`.
Note: keep in mind operations like limit and offset in the preload
query will affect the whole result set and not each association. For
example, the query below:
Expand Down

0 comments on commit a2e5b82

Please sign in to comment.