Is there any way to preload ecto associations without explicitly using preload:?
Something like an option in the schema?
schema "gadgets" do
field :foo,
has_many :bars, Myapp.Bar, preload: true
end
I'm doing something like
Repo.get(Gadget, id)
|> Repo.preload: [:bars]
Edit: the reason I'm trying to do this is because I want to preload a related model to the already preloaded related model, like
preload: [:invoices preload: :items]