search for: other_details

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

Did you mean: order_details
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 nothing like this works, because when this initial SQL statement is exec...