Created
July 5, 2016 20:41
-
-
Save mcelaney/75ca581ba2bf9649e377ba685d2090db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ProductVehicle do | |
def vehicles_that_fit_product(query \\ ProductVehicle, product_id) do | |
query | |
|> join(:inner, | |
[products_vehicles], | |
product in assoc(products_vehicles, :product)) | |
|> join(:inner, | |
[products_vehicles], | |
vehicle in assoc(products_vehicles, :vehicle)) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment