Created
July 31, 2012 21:56
-
-
Save traviskroberts/3221018 to your computer and use it in GitHub Desktop.
Grab unique vintages for accounts stocks.
This file contains hidden or 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
def stocked_styles | |
joins("INNER JOIN wine_instances wi ON wi.id = stocks.wine_instance_id INNER JOIN wines w ON w.id = wi.wine_id INNER JOIN styles s ON s.id = w.style_id").select("DISTINCT(s.name) AS style_name").order("style_name").map { |s| s.style_name } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment