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
>@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 }
--~--~-~--~~~-
2 matches
Mail list logo