Skip to content

Instantly share code, notes, and snippets.

@elbow-jason
Created September 25, 2015 20:39
Show Gist options
  • Save elbow-jason/10dd7fd542396b62d690 to your computer and use it in GitHub Desktop.
Save elbow-jason/10dd7fd542396b62d690 to your computer and use it in GitHub Desktop.
query example
defp planting_operations_only do
from operation in Operation,
where: operation.operation_type == "planting",
preload: :variety
end
def crop_plan_preloads(query) do
from q in query,
preload: :crop,
preload: :fields,
preload: [operations: ^planting_operations_only]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment