[Rails] Re: sorting by subsidiary class

2009-02-23 Thread Frederick Cheung
On Feb 22, 3:48 pm, DanC wrote: > i.e. in my categories controller > >     @category = Category.find(params[:id]) >     @services=Service.find(:all, :order => "XXX", :conditions => > ['category_id = ?', @category.id]) > If you join the discounts table you can just order by discounts.percen

[Rails] Re: sorting by subsidiary class

2009-02-22 Thread Sarah Mei
>@category = Category.find(params[:id]) >@services=Service.find(:all, :order => "XXX", :conditions => > ['category_id = ?', @category.id]) @category = Category.find(params[:id]) @category.services.sort! { |x, y| x.reduction <=> y.reduction } --~--~-~--~~~-