Created
January 13, 2011 19:49
-
-
Save naru/778467 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
# quantity isn't an attribute of the current model, so it doesn't show up in results | |
named_scope :distinct_for_invoice, lambda {|ids| { | |
:select => 'count(id) as quantity, product_id, net_price_in_cents', | |
:conditions => ["id IN (?)", ids], | |
:group => 'product_id, net_price_in_cents' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment