search for: sales_count

Displaying 1 result from an estimated 1 matches for "sales_count".

Did you mean: rules_count
2007 Aug 29
2
:order based on an aggregate value?
Hi all, I''m building an app where each :referral has_many :sales. In a list of all referrals, I''m displaying referral.date, referral.other_details, and also referral.sales.count. I want to able to sort this list by that last column -- the number of sales per referral. Abstractly, I want to do something like @referrals=Referral.find(:all, :order=>sales.count_all). But