Skip to content

Instantly share code, notes, and snippets.

@stueccles
Last active October 15, 2015 19:17
Show Gist options
  • Save stueccles/f13624bfd8f2c450f157 to your computer and use it in GitHub Desktop.
Save stueccles/f13624bfd8f2c450f157 to your computer and use it in GitHub Desktop.
Select a single row from an Ecto association
def line_item_query(order, variant_id) do
from l in assoc(order, :line_items),
where: l.variant_id == ^variant_id,
select: l
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment