Repo.insert(changeset)
returns {:ok, struct}
, but struct has no preloaded associations.
Am I forced to select query to preload it's associations? Or can I avoid a useless query somehow?
Repo.insert(changeset)
returns {:ok, struct}
, but struct has no preloaded associations.
Am I forced to select query to preload it's associations? Or can I avoid a useless query somehow?
© 2022 - 2024 — McMap. All rights reserved.
Repo.preload/3
yourself. – SanjakRepo.insert!
, yes. If you just useRepo.insert
, you are going to have to unwrap the tuple first. @JoséValim, It couldbelong_to
another record, so it is possible there is something to preload. – Sanjakcast_assoc
– Bituminouscast_assoc
would only cast a related record but not preload it when inserting. – Garbelongs_to
, if you were usingcast_assoc
on it – Bituminous